new to ansible.
I installed ansible in ubuntu vm 14.04.1 version using ppa installation
user@ubuntu:~$ ansible --version
ansible 1.7
And created the hosts
file with localhost
only
user@ubuntu:~$ cat hosts
localhost
When I try to run this simple command
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`.
UPDATE when I follow the instruction to remove the execution mode for hosts
file, it works.
But the message is still quite strange for me, why need execute hosts
file.
What's wrong with this ?
There are a few types of files that can be passed to ansible with the -i
option.
In your case Ansible assumed that because you had the executable bit set on the file hosts that it was a dynamic inventory executable.
It's very common to use a dynamic inventory file (2) for situations where you need to discover the ip addresses of the hosts that you want to work on. One example is the case where you need to query a directory service of some sort or maybe an API to get a list of hosts that are grouped on the fly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With