Hi guys,
When I executing ansible-playbook command manually it works like a charm:
$ ansible-playbook --inventory-file=…/hosts --private-key=/root/.ssh/ansible.private.key test.yml
PLAY [fakegroup] *********************
GATHERING FACTS *********************
ok: [fakehost.example.org]
TASK: [fake ansible task] *********************
changed: [fakehost.example.org]
PLAY RECAP *********************
fakehost.example.org : ok=2 changed=1 unreachable=0 failed=0
But when I edit playbook and add a shebang header of the same command as above it fails:
$ ./test.yml
ERROR: Unable to find an inventory file, specify one with -i ?
Here is an example of my playbook:
$ cat test.yml
#!/usr/bin/ansible-playbook --inventory-file=…/hosts --private-key=/root/.ssh/ansible.private.key