ansable yum无法正常工作

问题描述 投票:4回答:3

当我在ops机器上运行命令时:

ansible web -b -l 192.168.31.101 -m yum -a "name=gcc state=latest"

它返回错误,如下所示:

192.168.31.101 | FAILED! => {
    "changed": false,
    "failed": true,
    "msg": "python2 bindings for rpm are needed for this module. python2 yum module is needed for this  module" 
}

但是当我直接在sudo yum install gcc上直接执行命令192.168.31.101时,则正确执行。

似乎ansible无法使用正确的yum和python

python ansible centos7 yum
3个回答
5
投票

我找到了解决方案,只需在主机文件中添加一个python路径

ansible_python_interpreter=/usr/bin/python2.7

0
投票

这发生在我身上,因为我在机器上安装了python2.7和python3。 ansible正在使用python3,因此出现错误。所以我必须像下面在我的makefile目标中一样明确指定它/bin/python2.7 /bin/ansible-playbook configure-box.yml


0
投票

所以python2在几周内就停产了。关于升级这些模块有什么想法吗?

© www.soinside.com 2019 - 2024. All rights reserved.