NemoSaltatSobrius
NemoSaltatSobrius

Reputation: 41

No package_facts from Ubuntu 18 server?

I though package_facts module seemed useful but on a Ubuntu 18.04 server I get an "unsupported" message, is this a bug?

- name: get the rpm or apt package facts
  package_facts:
    manager: "auto"

output:

{"ansible_facts": {"packages": {}}, "changed": false, "msg": "Unsupported package manager: auto"}

If a change to manager "apt" I get:

FAILED! => {"changed": false, "msg": "Unable to use the apt python bindings, please ensure they are installed under the python the module runs under"}

Upvotes: 0

Views: 1258

Answers (1)

Vladimir Botka
Vladimir Botka

Reputation: 68144

(Ubuntu 18.04, Ansible 2.7.9, Python 2.7.15+)

Short answer

Install Ubuntu package python-apt

Details

The module package_facts requires the Python apt package.

$ grep 'import apt' /home/admin/.local/lib/python2.7/site-packages/ansible/modules/packaging/os/package_facts.py
    import apt

This Python package is provided by the Ubuntu package python-apt

$ apt-file list python-apt
python-apt: /usr/lib/python2.7/dist-packages/apt/__init__.py
...

Upvotes: 2

Related Questions