# Get project directory in a playbook

**URL:** <https://forum.ansible.com/t/get-project-directory-in-a-playbook/31678>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [November 18, 2019, 6:22pm UTC](https://forum.ansible.com/t/get-project-directory-in-a-playbook/31678 "2019-11-18T18:22:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Nanboe](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@Daniel\_Nanboe](https://forum.ansible.com/u/Daniel_Nanboe)\
**Post date:** [November 18, 2019, 6:22pm UTC](https://forum.ansible.com/t/get-project-directory-in-a-playbook/31678/1 "2019-11-18T18:22:36Z")

</div>

Hi all,  
For a playbook I need to get the projects directory in order not to hardcode it in the playbook or create an bash variable. Is this possible?  
The project is on git and is cloned using awx project with git as source.

Thanks  
Daniel

---

<div class="post-metadata">

**Author:** ![Konstantin1](https://avatars.discourse-cdn.com/v4/letter/k/e495f1/32.png) [@Konstantin1](https://forum.ansible.com/u/Konstantin1)\
**Post date:** [November 18, 2019, 7:49pm UTC](https://forum.ansible.com/t/get-project-directory-in-a-playbook/31678/2 "2019-11-18T19:49:39Z")

</div>

Hi Daniel,

You use the following variable:

playbook\_dirThe path to the directory of the playbook that was passed to the `ansible-playbook`command line.[https://docs.ansible.com/ansible/latest/reference\_appendices/special\_variables.html](https://docs.ansible.com/ansible/latest/reference\_appendices/special\_variables.html)

Konstantin.

---

<div class="post-metadata">

**Author:** ![Daniel\_Nanboe](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@Daniel\_Nanboe](https://forum.ansible.com/u/Daniel_Nanboe)\
**Post date:** [November 20, 2019, 11:01am UTC](https://forum.ansible.com/t/get-project-directory-in-a-playbook/31678/3 "2019-11-20T11:01:26Z")

</div>

Thanks for the answer it worked and with a little regex I could get the path of the project.
