package_facts – package information as facts¶
New in version 2.5.
Requirements¶
The below requirements are needed on the host that executes this module.
- For ‘portage’ support it requires the
qlist
utility, which is part of ‘app-portage/portage-utils’. - For Debian-based systems
python-apt
package must be installed on targeted hosts.
Parameters¶
Examples¶
- 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"
Returned Facts¶
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.
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Matthew Jones (@matburt)
- Brian Coca (@bcoca)
- Adam Miller (@maxamillion)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.