ansible.builtin.package_facts – Package information as facts¶
Note
This module is part of ansible-base
and included in all Ansible
installations. In most cases, you can use the short module name
package_facts even without specifying the collections:
keyword.
Despite that, we recommend you use the FQCN for easy linking to the module
documentation and to avoid conflicting with other collections that may have
the same module name.
New in version 2.5: of ansible.builtin
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 package facts
ansible.builtin.package_facts:
manager: auto
- name: Print the package facts
ansible.builtin.debug:
var: ansible_facts.packages
- name: Check whether a package called foobar is installed
ansible.builtin.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.
Authors¶
Matthew Jones (@matburt)
Brian Coca (@bcoca)
Adam Miller (@maxamillion)