Add ansible_play_name magic var (#48562)

pull/48573/head
Martin Krizek 6 years ago committed by Sandra McCann
parent 1fff542623
commit 1465f70eb5

@ -0,0 +1,2 @@
minor_changes:
- Add ``ansible_play_name`` magic var (https://github.com/ansible/ansible/issues/11349)

@ -76,9 +76,15 @@ omit
play_hosts play_hosts
Deprecated, the same as ansbile_play_batch Deprecated, the same as ansbile_play_batch
ansible_play_name
The name of the currently executed play. Added in ``2.8``.
playbook_dir playbook_dir
The path to the directory of the playbook that was passed to the ``ansible-playbook`` command line. The path to the directory of the playbook that was passed to the ``ansible-playbook`` command line.
role_name:
The name of the currently executed role
role_names role_names
The names of the rules currently imported into the current play. The names of the rules currently imported into the current play.

@ -452,6 +452,7 @@ class VariableManager:
if play: if play:
variables['role_names'] = [r._role_name for r in play.roles] variables['role_names'] = [r._role_name for r in play.roles]
variables['ansible_play_name'] = play.get_name()
if task: if task:
if task._role: if task._role:

Loading…
Cancel
Save