【问题标题】:Ansible 2.4 upgrade and python 2.6 on CentOS 5CentOS 5 上的 Ansible 2.4 升级和 python 2.6
【发布时间】:2018-03-10 20:59:35
【问题描述】:

我将我的 ansible 升级到 2.4,现在我无法管理运行 python 2.4 的 CentOS 5 主机。我该如何解决?

http://docs.ansible.com/ansible/2.4/porting_guide_2.4.html 表示 ansible 2.4 将不支持任何低于 2.6 的 python 版本

【问题讨论】:

    标签: python centos ansible


    【解决方案1】:

    升级到 ansible 2.4 后,我无法管理运行 python 2.6+ 的主机。这些是 CentOS 5 主机,这就是我解决问题的方法。

    首先,我从 epel repo 安装了python26。启用 epel repo 后,yum install python26

    然后在我的 hosts 文件中,对于 CentOS 5 主机,我添加了 ansible_python_interpreter=/usr/bin/python26 作为 python 解释器。

    在hosts文件中单独指定python解释器,类似于

    centos5-database ansible_python_interpreter=/usr/bin/python26

    对于一组主机,它会是这样的

    [centos5-www:vars] ansible_python_interpreter=/usr/bin/python26

    【讨论】:

    【解决方案2】:

    那么 python26-yum 包呢?使用 Ansible 安装包需要使用 yum 模块。

    【讨论】:

      【解决方案3】:

      到目前为止,我的经验是 anisible 可以工作(收集事实),但某些模块(特别是 yum / 包)不能,因为 yum 使用 python 2.4。 我最终通过命令和 shell 模块使用了 yum(不是很漂亮,但很有效)。

      1) 在安装 python26 之前,您需要修复 repos,因为 CentOS5 已停产: (YumRepo Error: All mirror URLs are not using ftp, http[s] or file)

      2) 然后你可以安装 EPEL 5 和 pthon26 (https://www.ansible.com/blog/using-ansible-to-manage-rhel-5-yesterday-today-and-tomorrow)

      3) 那么就可以通过命令模块来使用yum了: (CentOS 5. ansible_python_interpreter=/usr/bin/python26. Still cannot use yum: module)

      由于缺少 python 依赖项,许多较新的 ansible 模块也无法工作。

      我的目的只是在 CentOS5(或 RH 5)中使用 Ansible 来促进升级到更新和支持的东西。 ;)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-08-10
        • 2017-03-30
        • 2019-01-13
        • 2019-01-30
        • 2015-09-01
        • 1970-01-01
        • 1970-01-01
        • 2015-07-23
        相关资源
        最近更新 更多