在 debian 11 Bullseye 上使用 Ansible 安装损坏的软件包
Broken package installation using Ansible on debian 11 Bullseye
我想在 Debian 测试中使用 Ansible 2.7.7 安装 debian 软件包(尚未)
我尝试执行这个简单的任务:
tasks:
- name: install basic packages
apt:
name: ['mc', 'htop', 'strace','sudo','screen','lshw', 'postfix', 'etckeeper']
state: present
但是安装失败并出现奇怪的消息:
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
apt 所需的 python 软件包安装为 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 -
github 上有一个已关闭但未解决的问题:https://github.com/ansible/ansible/issues/73535 这对我没有任何帮助。
如何像在 Debian 10 上一样工作?
python3 在主机文件中作为解释器的规范
[webservers]
webserver.vitexsoftware.cz ansible_host=10.11.56.210 ansible_python_interpreter=/bin/python3
做好工作:
TASK [install basic packages] ************************************************************************************************************************************************************************************************************************************************
changed: [webserver.vitexsoftware.cz]
另一个对我有用的选项是从目标主机中删除 python2。
我想在 Debian 测试中使用 Ansible 2.7.7 安装 debian 软件包(尚未)
我尝试执行这个简单的任务:
tasks:
- name: install basic packages
apt:
name: ['mc', 'htop', 'strace','sudo','screen','lshw', 'postfix', 'etckeeper']
state: present
但是安装失败并出现奇怪的消息:
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
apt 所需的 python 软件包安装为 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 -
github 上有一个已关闭但未解决的问题:https://github.com/ansible/ansible/issues/73535 这对我没有任何帮助。
如何像在 Debian 10 上一样工作?
python3 在主机文件中作为解释器的规范
[webservers]
webserver.vitexsoftware.cz ansible_host=10.11.56.210 ansible_python_interpreter=/bin/python3
做好工作:
TASK [install basic packages] ************************************************************************************************************************************************************************************************************************************************
changed: [webserver.vitexsoftware.cz]
另一个对我有用的选项是从目标主机中删除 python2。