playbook_file

Hi List.

There are some global variables about a run, like inventory_dir or inventory_file.
Is their a similar set of variable for the playbook_file (when running ansible-playbook )?

In the same vein,
is it possible to retrieve the command line that triggered the run i.e… “ansible-playbook -i path/to/inventory path/to/playbook” ?

I would need these for some specific logging purpose.

Thank you.
raphael.

There is playbook_dir, but not file.

I’d generally argue that if your playbook needs to know the filename of itself, it has too much self awareness.

I do understand why it would be useful for logging purposes though.

I can see this being useful for things like the {{ ansible_managed }} template file, as well, though the same role could be applied by different playbooks.