gpt4 book ai didi

amazon-web-services - 如何在 Amazon Linux EC2 中安装 Ansible?

转载 作者:行者123 更新时间:2023-12-01 08:36:57 60 4
gpt4 key购买 nike

我选择这个 Amazon Linux:Amazon Linux AMI 2017.09.1 (HVM),SSD 卷类型 - ami-1a033c7a。我使用以下命令安装了 Ansible:

sudo pip install ansible, 

它显示安装完成。当我运行 ansible --version 时,它显示:

ansible 2.4.1.0
config file = None
configured module search path = [u'/home/ec2-
user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/site-
packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.12 (default, Nov 2 2017, 19:20:38) [GCC 4.8.5
20150623 (Red Hat 4.8.5-11)]

为什么 config file = None?它不应该显示 /etc/ansible/ansible.cfg 吗?我没有看到 /etc/ansible/hosts,甚至没有看到文件夹 /etc/ansible。我是否安装正确,文件夹 /etc/ansible 在哪里?

最佳答案

why config file = None?

因为在运行 ansible --version 时没有找到配置文件。

shouldn't it shows /etc/ansible/ansible.cfg?

没有。它应该显示实际使用的 ansible.cfg

根据文档,Ansible 尝试在以下位置找到配置文件:

  • ANSIBLE_CONFIG (an environment variable)
  • ansible.cfg (in the current directory)
  • .ansible.cfg (in the home directory)
  • /etc/ansible/ansible.cfg

ansible --version 将向您显示正在使用的版本的确切路径。

严格来说,最后一点并不总是正确的,因为包管理器和虚拟环境管理器可能会导致 /etc 目录位于其他位置。

did I install correctly

您在安装过程中没有提到任何错误或警告,ansible --version 返回了正确的响应。

没有理由不相信它安装正确。

where is the folder /etc/ansible?

它不存在于您的系统中。没有默认的 list 文件,也没有安装包创建的配置文件。

创建一个。

关于amazon-web-services - 如何在 Amazon Linux EC2 中安装 Ansible?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47195573/

60 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com