When Vagrant (or VirtualBox?) shares folder from Windows host, all files inside are made executable (because Windows uses different filesystem). This makes it impossible to run Ansible with invetory file that is located in shared dir (default location is /vagrant) and gives the following error:
vagrant@node:~$ ansible-playbook -i /vagrant/inventory.devbox /vagrant/node.yml ERROR: The file /vagrant/inventory.devbox is marked as executable, but failed to execute correctly. If this is not supposed to be an executable script, correct this with
chmod -x /vagrant/inventory.devbox`.
`
Of course, chmod doesn’t work in this situation. I tried to hack it with #!/bin/cat shebang line, but it failed again with “cat: unrecognized option ‘–list’”, which couldn’t work anyway, because executable inventories are supposed to return JSON.
There are two solutions:
- copy inventory file every time to Linux filesystem, change permissions and execute from there
- tell Ansible to ignore executable bit and threat file as plain inventory
Is solution 2 possible?
If not - does this story worth implementing solution 2?