Pablo
Pablo

Reputation: 29519

How to change hostname for dynamic inventory?

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. It's clear that ec2.py can't tell me dns names for the hosts. However, in my playbook I am able to obtain dns names for each host. Question is how can I alter hostname for current host, so at the end I see dns name instead of IP address?

Upvotes: 2

Views: 1594

Answers (1)

Arbab Nazar
Arbab Nazar

Reputation: 23801

Inside your ec2.ini, please find these parameters and uncomment if they didn't:

destination_variable = public_dns_name
hostname_variable = tag_Name

For detail, visit this link

Upvotes: 1

Related Questions