title: How to get just the version of the software when using ansible_facts.packages["zabbix-agent"]
body: <p>I'm having an issue with using the package_facts module in Ansible. Basically, I just want to get the version of zabbix-agent installed as I need to do some stuff depending on which version is installed.</p>
  
  <p>Now I got this in a playbook task:</p>
  
  <pre><code>- name: Gather Installed Packages Facts
    package_facts:
      manager: "auto"
    tags:
      - zabbix-check
  
  - name: "Zabbix Found test result"
    debug: var=ansible_facts.packages['zabbix-agent']
    when: "'zabbix-agent' in ansible_facts.packages"
    tags:
      - zabbix-check
  
  - name: "Zabbix Not-found test result"
    debug: 
      msg: "Zabbix NOT found"
    when: "'zabbix-agent' not in ansible_facts.packages"
    tags:
      - zabbix-check
  </code></pre>
  
  <p>Which spits out something like this:</p>
  
  <pre><code>ok: [vm3] =&gt; {
      "ansible_facts.packages['zabbix-agent']": [
          {
              "arch": "x86_64", 
              "epoch": null, 
              "name": "zabbix-agent", 
              "release": "1.el7", 
              "source": "rpm", 
              "version": "4.0.10"
      ]
  }
  ok: [vm4] =&gt; {
      "ansible_facts.packages['zabbix-agent']": [
          {
              "arch": "x86_64", 
              "epoch": null, 
              "name": "zabbix-agent", 
              "release": "1.el7", 
              "source": "rpm", 
              "version": "3.2.11"
          }
      ]
  }
  </code></pre>
  
  <p>I want to get the value of that "Version": "3.2.11" so that I can store that in a variable and use that later. I've seen that post using yum and doing some json query but that won't work for me.</p>