# How to access host inventory file entry from playbook?

**URL:** <https://forum.ansible.com/t/how-to-access-host-inventory-file-entry-from-playbook/13458>\
**Category:** Ansible Project\
**Created:** [September 11, 2013, 10:18pm UTC](https://forum.ansible.com/t/how-to-access-host-inventory-file-entry-from-playbook/13458 "2013-09-11T22:18:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierre\_Thibault](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@Pierre\_Thibault](https://forum.ansible.com/u/Pierre_Thibault)\
**Post date:** [September 11, 2013, 10:18pm UTC](https://forum.ansible.com/t/how-to-access-host-inventory-file-entry-from-playbook/13458/1 "2013-09-11T22:18:56Z")

</div>

It is possible to access the host name or the ip address used in the inventory file from a playbook?

---

<div class="post-metadata">

**Author:** ![Eric\_Palmer1](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Eric\_Palmer1](https://forum.ansible.com/u/Eric_Palmer1)\
**Post date:** [September 11, 2013, 10:23pm UTC](https://forum.ansible.com/t/how-to-access-host-inventory-file-entry-from-playbook/13458/2 "2013-09-11T22:23:05Z")

</div>

{{ inventory\_hostname }}

---

<div class="post-metadata">

**Author:** ![Pierre\_Thibault](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@Pierre\_Thibault](https://forum.ansible.com/u/Pierre_Thibault)\
**Post date:** [September 11, 2013, 10:42pm UTC](https://forum.ansible.com/t/how-to-access-host-inventory-file-entry-from-playbook/13458/3 "2013-09-11T22:42:09Z")

</div>

Thank you. Exactly what I needed!
