title: Errors when use "json_query" in Ansible
body: <p>When use <code>json_query</code> in Ansible, got the error along with my code as shown below.</p>
  <p>The Python used in Ansible is 3.6.8, and used the same version installed <code>jmespath</code>: <code>pip install jmespath</code>, so, this should not be the issue. The Ansible code should be fine as well.</p>
  <pre><code>fatal: [localhost]: FAILED! =&gt; {&quot;msg&quot;: &quot;template error while templating string: no filter named 'json_query'. String: {{ jsondata | json_query(jmesquery) }}&quot;
  </code></pre>
  <p>The following is the Ansible codes:</p>
  <pre class="lang-yaml prettyprint-override"><code>---
  - name: ReadJsonfile
    hosts: localhost
    tasks:
      - name: Display the JSON file content
    shell: cat config.json
    register: result
  
  - name: save the JSON data to a Variable as a Fact
    set_fact:
      jsondata: &quot;{{ result.stdout | from_json }}&quot;
  
  - name: setDomainName
    set_fact:
      domain_name: &quot;{{ jsondata | json_query(jmesquery) }}&quot;
  
    vars:
      jmesquery: 'domain.name'
  
  - name: setDomainUsername
    set_fact:
      domain_username: &quot;{{ jsondata | json_query(jmesquery) }}&quot;
  
    vars:
      jmesquery: 'domain.user'
  
  - name: setDomainPassword
    set_fact:
      domain_password: &quot;{{ jsondata | json_query(jmesquery) }}&quot;
  
    vars:
      jmesquery: 'domain.password'
  
  - name: setadmin_Listenport
    set_fact:
      admin_ListenPort: &quot;{{ jsondata | json_query(jmesquery) }}&quot;
  
    vars:
      jmesquery: 'domain.admin.listenport'
  
  - name: Debug the values
    debug: msg=&quot; Admin Listen Port =&gt; {{ admin_ListenPort }}, DomainName =&gt; {{ domain_name }}, DomainUserName =&gt; {{ domain_username }} , Domain Password =&gt; {{ domain_password }}&quot;
  </code></pre>