CentOS 5. ansible_python_interpreter=/usr/bin/python26.仍然无法使用 yum: 模块 [英] CentOS 5. ansible_python_interpreter=/usr/bin/python26. Still cannot use yum: module

查看:23
本文介绍了CentOS 5. ansible_python_interpreter=/usr/bin/python26.仍然无法使用 yum: 模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仍然需要保留一些 CentOS5 主机,它们已将 yum 配置为使用 CentOS vault 存储库,如下所示 https://hastebin.com/ojopevanas.ini.在主机上使用 yum 时效果很好.然而,当我尝试使用 ansible 时,例如:

Still have to keep some CentOS5 hosts, they have yum configured to use CentOS vault repo like this https://hastebin.com/ojopevanas.ini. That works fine when use yum there on host. When however I try to use ansible for that, like:

   - name: "Install OS packages"
     yum: pkg={{item}} state=installed
     with_items: 
       - dos2unix
       - vim 

我得到 "msg": "这个模块需要 rpm 的 python2 绑定.这个模块需要 python2 yum 模块"

注意:主机在 default24 旁边安装了 python26在清单文件主机名旁边有 ansible_python_interpreter=/usr/bin/python26 (否则 ansible 甚至不能 -m ping).其他 ansible 任务在此主机上运行良好

NOTE: the host has python26 installed next to default24 in the inventory file hostname has ansible_python_interpreter=/usr/bin/python26 next to it (otherwise ansible cannot even -m ping). Other ansible tasks works fine with this host

推荐答案

yum 模块需要 rpm Python 模块,该模块由 rpm-python 包.在您的系统上,这是为 Python 2.4 安装的;你还没有为 Python 2.6 安装它.这是一个必须从源代码编译的二进制模块(它是 rpm 发行版的一部分).

The yum module requires the rpm Python module, which is provided by the rpm-python package. On your system, this is installed for Python 2.4; you haven't installed it for Python 2.6. This is a binary module that must be compiled from source (it is part of the rpm distribution).

如果您需要支持 CentOS 5,最简单的解决方案可能是使用 command 模块代替 yum 模块:

If you need to support CentOS 5, the easiest solution is probably to use the command module in lieu of the yum module:

- name: "Install OS packages"
  command: "yum install -y -e0 -d2 {{item}}"
  with_items: 
    - dos2unix
    - vim 

这篇关于CentOS 5. ansible_python_interpreter=/usr/bin/python26.仍然无法使用 yum: 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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