New in version 2.5.
The below requirements are needed on the host that executes this module.
qlist
utility, which is part of ‘app-portage/portage-utils’.python-apt
package must be installed on targeted hosts.Parameter | Choices/Defaults | Comments |
---|---|---|
manager list |
["auto"] | The package manager used by the system so we can query the package information. Since 2.8 this is a list and can support multiple package managers per system. The 'portage' and 'pkg' options were added in version 2.8. |
strategy - added in 2.8 |
| This option controls how the module queries the package managers on the system. first means it will return only information for the first supported package manager available. all will return information for all supported and available package managers on the system. |
- name: Gather the rpm package facts package_facts: manager: auto - name: Print the rpm package facts debug: var: ansible_facts.packages - name: Check whether a package called foobar is installed debug: msg: "{{ ansible_facts.packages['foobar'] | length }} versions of foobar are installed!" when: "'foobar' in ansible_facts.packages"
Facts returned by this module are added/updated in the hostvars
host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
Fact | Returned | Description | |
---|---|---|---|
packages dictionary | when operating system level package manager is specified or auto detected manager | Maps the package name to a non-empty list of dicts with package information. Every dict in the list corresponds to one installed version of the package. The fields described below are present for all package managers. Depending on the package manager, there might be more fields for a package. Sample: { "packages": { "kernel": [ { "name": "kernel", "source": "rpm", "version": "3.10.0", ... }, { "name": "kernel", "source": "rpm", "version": "3.10.0", ... }, ... ], "kernel-tools": [ { "name": "kernel-tools", "source": "rpm", "version": "3.10.0", ... } ], ... } } | |
name string | always | The package's name. | |
source string | always | Where information on the package came from. | |
version string | always | The package's version. |
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/package_facts_module.html