ansible 的新手。
我使用ppa安装在ubuntu vm 14.04.1版本中安装了ansible
user@ubuntu:~$ ansible --version
ansible 1.7
并创建了
hosts
文件与 localhost
只要user@ubuntu:~$ cat hosts
localhost
当我尝试运行这个简单的命令时
user@ubuntu:~$ ansible -i hosts all -m ping --ask-pass
SSH password:
ERROR: The file hosts is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with `chmod -x hosts`.
更新 当我按照说明删除
hosts
的执行模式时文件,它的工作原理。但是这个消息对我来说还是很奇怪,为什么需要执行
hosts
文件。这有什么问题?
最佳答案
有几种类型的文件可以通过 -i
传递给 ansible。选项。
在您的情况下,Ansible 假设因为您在文件主机上设置了可执行位,所以它是动态 list 可执行文件。
在需要发现要处理的主机的 IP 地址的情况下,使用动态 list 文件 (2) 是很常见的。一个例子是您需要查询某种目录服务或 API 以获取动态分组的主机列表。
关于ansible - 简单的ansible命令满足 "ERROR: The file hosts is marked as executable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25458343/