# How can i retrieve playbook name, play name and task name in a playbook?

**URL:** <https://forum.ansible.com/t/how-can-i-retrieve-playbook-name-play-name-and-task-name-in-a-playbook/30373>\
**Category:** Ansible Project\
**Created:** [May 20, 2019, 7:17am UTC](https://forum.ansible.com/t/how-can-i-retrieve-playbook-name-play-name-and-task-name-in-a-playbook/30373 "2019-05-20T07:17:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankit2](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@Ankit2](https://forum.ansible.com/u/Ankit2)\
**Post date:** [May 20, 2019, 7:17am UTC](https://forum.ansible.com/t/how-can-i-retrieve-playbook-name-play-name-and-task-name-in-a-playbook/30373/1 "2019-05-20T07:17:23Z")

</div>

Is there a way i can retrieve the currently used playbook name, currently running play and task name using playbook rules? I need these 3 info to send them as a parameter for an external python script which would print a message using these 3 values so that the end users are aware of what task, playbook and play has resulted in that particular message. Is there a way i can retrieve these info during runtime in a playbook?

Regards,  
Ankit

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 20, 2019, 5:58pm UTC](https://forum.ansible.com/t/how-can-i-retrieve-playbook-name-play-name-and-task-name-in-a-playbook/30373/2 "2019-05-20T17:58:51Z")

</div>

This information is not available for a task in a play.  
But I belive you have access to all this information inside a callback plugin, maybe you can write your own plugin to do what you want.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [May 21, 2019, 6:12pm UTC](https://forum.ansible.com/t/how-can-i-retrieve-playbook-name-play-name-and-task-name-in-a-playbook/30373/3 "2019-05-21T18:12:41Z")

</div>

in 2.8 ansible\_play\_name
