An ansible-playbook wrapper, meant to be used as the interpreter for ansible playbooks.
- Run
make installto put ansible-exec in/usr/local/binand config in/etc/ansible - Put the path to ansible-exec.sh in a shebang line for a playbook you wish to exec:
#!/usr/local/bin/ansible-exec - Add execute permissions to the playbook:
chmod u+x playbook.yml - Run it!
./playbook.yml
ansible-exec currently handlers three kinds of parameters passed to the playbook when executing:
-i INVENTORY: Set the inventory file to use, relative to the playbook. If not passed, a dummy inventory will be used (useful for localhost playbooks).--variable VALUE: Set variable to VALUE. Will be passed toansible-playbookas:-e variable="VALUE"- Raw ansible-playbooks parameters: Just put them after a
--parameter:./playbook.yml -i inventory -- --skip-tags someapp
You can place a config file at ~/.ansible_exec.conf or /etc/ansible/ansible_exec.conf. Currently available options:
- ANSIBLE_PLAYBOOK_ARGS: Parameters that will always be passed to
ansible-playbook. Useful for vault passoword files. - DEFAULT_INVENTORY: Override the default dummy inventory behavior when
-iisn't passed.