# how to get the name of current running playbook

**URL:** <https://forum.ansible.com/t/how-to-get-the-name-of-current-running-playbook/28249>\
**Category:** Ansible Project\
**Created:** [August 3, 2018, 8:52am UTC](https://forum.ansible.com/t/how-to-get-the-name-of-current-running-playbook/28249 "2018-08-03T08:52:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Han\_Lu](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Han\_Lu](https://forum.ansible.com/u/Han_Lu)\
**Post date:** [August 3, 2018, 8:52am UTC](https://forum.ansible.com/t/how-to-get-the-name-of-current-running-playbook/28249/1 "2018-08-03T08:52:11Z")

</div>

I want to get the playbook name I performed.

ie:ansible-playbook -i hosts test.yaml

test.yaml is the playbook name I want to get. Is there a variable hold the value of “test.yaml” ?

use case:

- name: run test cases if the playbook is test.yaml  
shell: some test command  
when: current\_play == “test.yaml”

---

<div class="post-metadata">

**Author:** ![Han\_Lu](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Han\_Lu](https://forum.ansible.com/u/Han_Lu)\
**Post date:** [August 4, 2018, 8:15am UTC](https://forum.ansible.com/t/how-to-get-the-name-of-current-running-playbook/28249/2 "2018-08-04T08:15:27Z")

</div>



---

<div class="post-metadata">

**Author:** ![Ali\_Khawaja](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Ali\_Khawaja](https://forum.ansible.com/u/Ali_Khawaja)\
**Post date:** [August 4, 2018, 7:00pm UTC](https://forum.ansible.com/t/how-to-get-the-name-of-current-running-playbook/28249/3 "2018-08-04T19:00:55Z")

</div>

[https://stackoverflow.com/questions/43069097/ansible-callbacks-get-the-name-of-the-playbook-being-executed](https://stackoverflow.com/questions/43069097/ansible-callbacks-get-the-name-of-the-playbook-being-executed)

---

<div class="post-metadata">

**Author:** ![Han\_Lu](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Han\_Lu](https://forum.ansible.com/u/Han_Lu)\
**Post date:** [August 5, 2018, 9:37am UTC](https://forum.ansible.com/t/how-to-get-the-name-of-current-running-playbook/28249/4 "2018-08-05T09:37:12Z")

</div>


