ansible yum无法正常工作 [英] ansible yum not working

查看:258
本文介绍了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

推荐答案

我找到了解决方案,只需将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天全站免登陆