In my playbook, I ran local_action, which executes a script and saves the value for future use:
- local_action: command python release.py register: release_url
This worked great until I moved my book to a subdirectory. It turns out that the command runs from your current working directory (from which you run it), so the path should look like this:
- local_action: command python roles/ghost/release.py
I have a directory structure as shown below:
- group_vars /
- Roles /
- ghost /
- Tasks /
- Templates /
- release.py
- site.yml
However, the role / ghost folder name may change (and hard coding will prevent you from running the playbook from another directory).
How can I get the path to the /main.yml task directories (which calls the local_action command), so I can give a relative path to it?
source share