ec2 inventory to return Name tags

53 views
Skip to first unread message

Nicolas G

unread,
Oct 16, 2015, 1:16:13 AM10/16/15
to Ansible Project
Hi,

I'm able to run Ansible on AWS using ec2.py successfully but unfortunately I get the public DNS of the instance instead of the Name tag :

ansible -i plugins/inventory/ec2.py "tag_Environment_prod" -m shell -a "uptime"

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvde1      7.9G  6.4G  1.2G  85% /
tmpfs           296M     0  296M   0% /dev/shm
/dev/xvdj        99G  973M   93G   2% /srv


Is there a way I can set the return to be the ec2 tag names which reflects to my instances fqdn's so instead of seeing ec2-54-205-89-44.compute-1.amazonaws.com I want to see something like db3.example.com  ?

Regards,
Nicolas.

Alexey Vazhnov

unread,
Oct 20, 2015, 8:41:27 AM10/20/15
to Ansible Project
Try to set in your ec2.ini:

destination_variable=Name
Reply all
Reply to author
Forward
0 new messages