# accessing inventory path from playbook

**URL:** <https://forum.ansible.com/t/accessing-inventory-path-from-playbook/13226>\
**Category:** Ansible Project\
**Created:** [July 30, 2013, 10:08pm UTC](https://forum.ansible.com/t/accessing-inventory-path-from-playbook/13226 "2013-07-30T22:08:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Martin2](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@James\_Martin2](https://forum.ansible.com/u/James_Martin2)\
**Post date:** [July 30, 2013, 10:08pm UTC](https://forum.ansible.com/t/accessing-inventory-path-from-playbook/13226/1 "2013-07-30T22:08:35Z")

</div>

Is there a way to get the path to the inventory from within a  
playbook? Some special variable perhaps?

Thanks,

James

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 30, 2013, 10:13pm UTC](https://forum.ansible.com/t/accessing-inventory-path-from-playbook/13226/2 "2013-07-30T22:13:31Z")

</div>

Not currently.

There is {{ inventory\_dir }}

which gives you the basedir.

Should be a one line patch to provide {{ inventory\_file }}

---

<div class="post-metadata">

**Author:** ![James\_Martin](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@James\_Martin](https://forum.ansible.com/u/James_Martin)\
**Post date:** [July 30, 2013, 10:18pm UTC](https://forum.ansible.com/t/accessing-inventory-path-from-playbook/13226/3 "2013-07-30T22:18:34Z")

</div>

Awesome, thanks!
