新的回答.
我使用ppa安装在ubuntu vm 14.04.1版本中安装了ansible
user@ubuntu:~$ ansible --version
ansible 1.7
Run Code Online (Sandbox Code Playgroud)
并且只创建了hosts文件localhost
user@ubuntu:~$ cat hosts
localhost
Run Code Online (Sandbox Code Playgroud)
当我尝试运行这个简单的命令
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`.
Run Code Online (Sandbox Code Playgroud)
更新当我按照指令删除hosts文件的执行模式时,它工作.
但是这条消息对我来说仍然很奇怪,为什么需要执行hosts文件.
这有什么问题?
可以使用该-i选项将几种类型的文件传递给ansible .
在你的情况下,Ansible假设因为你在文件主机上设置了可执行位,它是一个动态库存可执行文件.
在需要发现要使用的主机的IP地址的情况下,使用动态库存文件(2)是很常见的.例如,您需要查询某种目录服务或API,以获取即时分组的主机列表.
| 归档时间: |
|
| 查看次数: |
2507 次 |
| 最近记录: |