ansible-playbook E: Package 'python-apt' has no installation candidate

现象

启动ansible在Ubuntu 20.10节点安装服务

ansible-playbook -i ./hosts inventory/nginx.yml

提示错误: E: Package 'python-apt' has no installation candidate

ansible-playbook E: Package 'python-apt' has no installation candidate

 

 

 

问题原因

Ubuntu 20.10移除了python2环境

 

解决方法

ansible host文件中添加以下内容

ansible_python_interpreter=/usr/bin/python3

 

ansible-playbook E: Package 'python-apt' has no installation candidate

 

 

 

再重试,问题解决。

ansible-playbook E: Package 'python-apt' has no installation candidate

 

上一篇:Ansible 自动化运维管理工具


下一篇:ansible的安装和ansible的模板