Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home Ansible variables that tells you the location in the controller's file system

Ansible variables that tells you the location in the controller's file system

published May 08, 2017 10:40   by admin ( last modified Jun 30, 2017 12:44 )

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('(/\\./.*)', '')  }}
Add comment

You can add a comment by filling out the form below. Plain text formatting. You can use the Markdown syntax for links and images. Comments are moderated.

Question: What is 5 + 4 ?
Your answer:
Ads