# Ansible Dynamic Inventory - generate inventory with ip addresses under specific tag with underscore instead of dot

**URL:** <https://forum.ansible.com/t/ansible-dynamic-inventory-generate-inventory-with-ip-addresses-under-specific-tag-with-underscore-instead-of-dot/23885>\
**Category:** Ansible Project\
**Created:** [March 4, 2017, 2:38pm UTC](https://forum.ansible.com/t/ansible-dynamic-inventory-generate-inventory-with-ip-addresses-under-specific-tag-with-underscore-instead-of-dot/23885 "2017-03-04T14:38:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Berlin](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@Berlin](https://forum.ansible.com/u/Berlin)\
**Post date:** [March 4, 2017, 2:38pm UTC](https://forum.ansible.com/t/ansible-dynamic-inventory-generate-inventory-with-ip-addresses-under-specific-tag-with-underscore-instead-of-dot/23885/1 "2017-03-04T14:38:23Z")

</div>

I am new to Ansible. When I am using `ec2.py` dynamic inventory to generate inventory, after the playbook is finished to run, the results are shown as list of IP addresses under specific tag with underscore instead of dot.  
For example I want to run a playbook on instances with specific tag, I wonder how other people work with IP addresses?

---

<div class="post-metadata">

**Author:** ![Berlin](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@Berlin](https://forum.ansible.com/u/Berlin)\
**Post date:** [March 4, 2017, 11:01pm UTC](https://forum.ansible.com/t/ansible-dynamic-inventory-generate-inventory-with-ip-addresses-under-specific-tag-with-underscore-instead-of-dot/23885/2 "2017-03-04T23:01:48Z")

</div>

It works if I comment out the hostname\_variable, because it allow to override the inventory\_name with an ec2 variable, instead of using the destination\_variable

`#hostname_variable = private_ip_address #hostname_variable = ip_address destination_variable = public_dns_name vpc_destination_variable = private_ip_address`

For Private IPs:

`  
destination\_variable = private\_ip\_address

`
