python - 在 fedora 上运行 ansible 返回下面的错误,这迫使我自己安装 python

标签 python linux fedora ansible

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

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

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

最佳答案

Python 2.4+ 是一个 requirement用于 Ansible 远程主机。

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

有一个异常(exception),那就是 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 在远程主机上运行软件,因此当然存在依赖关系。

关于python - 在 fedora 上运行 ansible 返回下面的错误,这迫使我自己安装 python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35868568/

相关文章:

linux - 如何检查前一次运行是否失败?

linux - 如何将 C 代码链接到 BoringSSL?

python - 如何在 python 脚本中调用 sed 命令?

python - 在 python 中解析和转换嵌套 xml

linux - sed 命令编辑多个文件(插入,替换行)

linux - 在 Fedora 中安装 OpenCv 的最佳方法是什么?

linux -/usr/bin/时间 : No such file or directory

fedora - Fedora 33 上的 Gnome Boxes 无法打开

python - 比较平面列表和嵌套列表

python - 在 python 中的 __str__ 方法上调用 super()?