ansible使用yum模块提示没有yum模块
ansible版本:
最开始使用ansible -m yum 出现的问题:
[root@ansible_01 ~]# ansible ansibletest -m yum -a "name=httpd state=latest"
192.168.122.13 | FAILED >> {
"failed": true,
"msg": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1446449048.01-255202696230448/yum\", line 27, in <module>\r\n import yum\r\nImportError: No module named yum\r\nOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: mux_client_request_session: master session id: 3\r\ndebug1: mux_client_request_session: master session id: 3\r\nShared connection to 192.168.122.13 closed.\r\n",
"parsed": false
}
192.168.122.14 | FAILED >> {
"failed": true,
"msg": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1446449048.01-24350147651889/yum\", line 27, in <module>\r\n import yum\r\nImportError: No module named yum\r\nOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: mux_client_request_session: master session id: 3\r\ndebug1: mux_client_request_session: master session id: 3\r\nShared connection to 192.168.122.14 closed.\r\n",
"parsed": false
}
192.168.122.12 | FAILED >> {
"failed": true,
"msg": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1446449048.01-164937528200411/yum\", line 27, in <module>\r\n import yum\r\nImportError: No module named yum\r\nOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: mux_client_request_session: master session id: 3\r\ndebug1: mux_client_request_session: master session id: 3\r\nShared connection to 192.168.122.12 closed.\r\n",
"parsed": false
}
一开始以为是我升级了python,所以它没找到yum模块
于是添加“ansible_python _ interpreter”配置:
但最后的结果还是一样:
有哪位遇到并解决了此问题的?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ansible换成了2.x版本,咋问题都没了
1 ansible_python _ interpreter 配置为 python2.6
2 修改 /usr/bin/yum 里为 旧的python解释器的路径即可
是不是你节点机是 ubuntu, 所以识别不了 yum 模块, yum 换 apt 试试呢.