Get parent directory in Ansible?
You can use {{playbook_dir}}
for the absolute path to your current playbook run.
For me thats the best way, because you normally know where your playbook is located.
You can use the dirname
filter:
{{ inventory_dir | dirname }}
For reference, see Managing file names and path names in the docs.