运行 ansible on fedora return 我遇到以下错误,迫使我自己安装 python

Running ansible on fedora return me with the error below which forces me to install python myself

我有一个 ansible 角色,可以在 AWS 的服务器上安装免费的 IPA。当我 运行 播放时,它应该安装 python 和 yum,因为我遇到过默认情况下没有安装 fedora 的问题。

我必须手动通过 SSH 连接到服务器并安装 yum 并安装 python 才能在服务器上成功 运行 进行 ansible 播放。

我想知道这是 Ansible 还是 Fedora 的问题,因为在每次部署后登录服务器都无法使用 ansible 和配置管理。

Python 2.4+ 是 Ansible 远程主机的 requirement

On the managed nodes, you need a way to communicate, normally ssh. By default this uses sftp, if not available you can switch to scp in ansible.cfg. Also you need Python 2.4 or later, but if you are running less than Python 2.5 on the remotes, you will also need:

  • python-simplejson

有一个例外,那就是raw module。这可以用于安装要求。

ansible myhost --sudo -m raw -a "yum install -y python2 python-simplejson"

或者在您的剧本中(但您需要在该剧本中禁用 gather_facts):

- raw: yum install -y python2 python-simplejson

当然,首先安装 yum 本身,但不知道如何安装,但您明白了。

What I want to know is if this is an Ansible or Fedora issue

自 Fedora 22 yum 已弃用。它在那个版本中仍然可用,因为它指向 dnf。不知道它是否仍在 Fedora 23 中这样做,但缺少 yum 表明它不是。

缺少 Python 是一个更常见的问题,但我自己只在一些非常老的 Debian 系统上遇到过。

我不会说这是 Fedora 或 Ansible 的问题。您的 Fedora 安装只是缺少 Ansible 需要的要求。 Ansible 是远程主机上的 运行 软件,因此当然存在依赖关系。