I woud like to install debian packages using Ansible 2.7.7 on Debian testing (yet)
I try to execute this simple task:
tasks:
- name: install basic packages
apt:
name: ['mc', 'htop', 'strace','sudo','screen','lshw', 'postfix', 'etckeeper']
state: present
But the installation is failing with strange message:
TASK [install basic packages] *********************************************************************************
fatal: [webserver.vitexsoftware.cz]: FAILED! => {"changed": false, "msg": "Could not import python modules: apt, apt_pkg. Please install python-apt package."}
to retry, use: --limit @/home/vitex/Projects/VitexSoftware/Ansible/playbooks/orchestrate.retry
The requied python package for apt is installed as python3-apt
vitex@webserver:~/Projects/VitexSoftware/DockerTools$ aptitude search python | grep '-apt'
i A python-apt-common - Python interface to libapt-pkg (locales)
p python-apt-dev - Python interface to libapt-pkg (development files)
p python-apt-doc - Python interface to libapt-pkg (API documentation)
i python3-apt - Python 3 interface to libapt-pkg
p python3-apt-dbg - Python 3 interface to libapt-pkg (debug extension)
v python3-apt-dbg:any -
v python3-apt:any -
p python3-aptly - Aptly REST API client and useful tooling - Python 3.x
v python3.9-apt -
v python3.9-apt-dbg -
v python3.9-apt-dbg:any -
v python3.9-apt:any -
There is an closed unresolved issue on github: https://github.com/ansible/ansible/issues/73535 which wont help me somehow.
How to make working as on Debian 10 ?
2
Answers
Specification of python3 as interpreter in hosts file
Make its job:
The other option that worked for me is to just remove python2 from the target host.