# aws inventory: \`hostname\_variable = tag\_Name\` not working

**URL:** <https://forum.ansible.com/t/aws-inventory-hostname-variable-tag-name-not-working/29858>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [March 9, 2019, 9:57pm UTC](https://forum.ansible.com/t/aws-inventory-hostname-variable-tag-name-not-working/29858 "2019-03-09T21:57:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [March 9, 2019, 9:57pm UTC](https://forum.ansible.com/t/aws-inventory-hostname-variable-tag-name-not-working/29858/1 "2019-03-09T21:57:34Z")

</div>

I haven’t used Ansible with AWS for a while.

I am using it on a new project. I see a newer option that didn’t used to be there:

`hostname_variable = tag_Name`

My understanding of this variable is that it will use the Name tag to name the host, while still using the i.p. address as the value of the ansible\_host key.

E.g.

`  
TASK [Get uptime] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [host01]

`

instead of

`  
TASK [Get uptime] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [1.2.3.4]

`

However, setting that value in ec2.ini doesn’t appear to work (as I’d expect). Am I misunderstanding this, or possibly just doing something wrong?

---

<div class="post-metadata">

**Author:** ![senorsmile](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/senorsmile/32/9024_2.png) [@senorsmile](https://forum.ansible.com/u/senorsmile)\
**Post date:** [March 10, 2019, 11:55pm UTC](https://forum.ansible.com/t/aws-inventory-hostname-variable-tag-name-not-working/29858/2 "2019-03-10T23:55:49Z")

</div>

This appears to be the PR where this functionality was added:  
[https://github.com/ansible/ansible/pull/7395](https://github.com/ansible/ansible/pull/7395)
