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

问题原因
Ubuntu 20.10移除了python2环境
解决方法
ansible host文件中添加以下内容
ansible_python_interpreter=/usr/bin/python3

再重试,问题解决。

浙公网安备 33010602011771号