Ansible variables that tells you the location in the controller's file system
Taken from here, where there is a list of many more variables in Ansible: lorin/ansible-quickref: Quick reference for Ansible variables
Description | |
---|---|
playbook_dir | Directory that contains the playbook being executed |
inventory_dir | Directory that contains the inventory |
inventory_file | Host file or script path (?) |
If you are using included playbooks, playbook_dir get really confused. It will report a path such as:
/home/use/playbook_dir/./sub_playbook_dir
You can truncate the path to before the dot, with a filter, like this:
"{{ playbook_dir | regex_replace('(/\\./.*)', '') }}