ansible yum 不工作 [英] ansible yum not working

查看:40
本文介绍了ansible yum 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

when i run command on the ops machine:

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 时,正确执行.

but when i execute the command sudo yum install gcc directly on 192.168.31.101, executed properly.

似乎ansible不能使用正确的yum和python

it seems like ansible can't use the right yum and python

推荐答案

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

I find the solution, just add a python path to hosts file

ansible_python_interpreter=/usr/bin/python2.7

这篇关于ansible yum 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆