# File name of the current playbook

**URL:** <https://forum.ansible.com/t/file-name-of-the-current-playbook/23977>\
**Category:** Ansible Project\
**Created:** [March 15, 2017, 1:07pm UTC](https://forum.ansible.com/t/file-name-of-the-current-playbook/23977 "2017-03-15T13:07:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aliok](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@aliok](https://forum.ansible.com/u/aliok)\
**Post date:** [March 15, 2017, 1:07pm UTC](https://forum.ansible.com/t/file-name-of-the-current-playbook/23977/1 "2017-03-15T13:07:55Z")

</div>

Hello,

I was looking for a way to get the file name of the current playbook.

Found an old thread, but no workarounds or solutions there.  
[https://groups.google.com/forum/#!searchin/ansible-project/playbook\_dir|sort:relevance/ansible-project/JMh1zguAAbI/crMsJP-rLZoJ](https://groups.google.com/forum/#!searchin/ansible-project/playbook_dir%7Csort:relevance/ansible-project/JMh1zguAAbI/crMsJP-rLZoJ)

Our use case is that we would like to log some message in an include with the the playbook file (not the playbook include).

“playbook\_dir” is out there, but it holds the directory that the playbook is in.

Any solutions/workarounds?

Cheers

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [March 15, 2017, 3:57pm UTC](https://forum.ansible.com/t/file-name-of-the-current-playbook/23977/2 "2017-03-15T15:57:14Z")

</div>

Simple but guaranteed to work: set a var in the playbook, use that.
