python - 百胜百胜不工作

标签 python ansible centos7 yum

当我在 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" 
}

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

ansible好像不能使用正确的yum和python

最佳答案

我找到了解决方案,只需将 python 路径添加到主机文件即可

ansible_python_interpreter=/usr/bin/python2.7

关于python - 百胜百胜不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47069450/

相关文章:

environment-variables - Ansible - 包括来自外部 YML 的环境变量

node.js - 而在 Centos 7 上安装 Node JS 4.8 则安装 6.11

bash - 如何在 bash 中获取 Centos 7 服务器的 ip 地址

python - 检查相应列表中是否存在值

ansible - 如何在亚马逊aws上安装ansible?

Python 日志记录 : create log if not exists or open and continue logging if it does

sql-server - Ansible 中的 SQL Server 数据库查询

magento - 使用SSL在CentOS 7,Nginx和PHP-FPM上设置Varnish

python - 从编译输出动态导入运行时指定的模块

Python-值错误: could not broadcast input array from shape (5) into shape (2)