# inventory\_hostname / ansible\_host

**URL:** <https://forum.ansible.com/t/inventory-hostname-ansible-host/31736>\
**Category:** Ansible Project\
**Created:** [November 27, 2019, 3:39pm UTC](https://forum.ansible.com/t/inventory-hostname-ansible-host/31736 "2019-11-27T15:39:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erichymowitz](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@erichymowitz](https://forum.ansible.com/u/erichymowitz)\
**Post date:** [November 27, 2019, 3:39pm UTC](https://forum.ansible.com/t/inventory-hostname-ansible-host/31736/1 "2019-11-27T15:39:16Z")

</div>

(I’m sure this is simple, but I can’t find it.)

I have a host in my /etc/ansbile/hosts file:

packard ansible\_host=vmoc-packard

I have a play that looks like this:

local\_action: “blah blah blah {{user}}@{{inventory\_hostname}} blah blah blah”

When I do this, the inventory\_hostname is “packard” … but what I want/need it to use is “vmoc-packard”

is there a variable that does this for me? I can’t find it in the ansible facts.

Thanks.

–EbH

---

<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:** [November 27, 2019, 3:50pm UTC](https://forum.ansible.com/t/inventory-hostname-ansible-host/31736/2 "2019-11-27T15:50:49Z")

</div>

Yes, and it's right in front of you, the variable i ansible\_host.
