Search on AWS inventory and add to hosts

29 views
Skip to first unread message

Navid Paya

unread,
Dec 13, 2014, 4:39:35 AM12/13/14
to ansible...@googlegroups.com
Hi all
I have come up with a search on AWS inventory. What I want to do is add the resulted instances to using add_host. This is how use ec2.py to find the instances:

ec2.py 'tag_Name_basebox_myteksi_net:&tag_Provisioned_False'

What would the task for this look like?

Michael DeHaan

unread,
Dec 15, 2014, 6:52:55 AM12/15/14
to ansible...@googlegroups.com
It would look like this, simply using the add host module to create a new group based on that pattern.

- hosts: tag_Name_basebox_myteksi_net:&tag_Provisioned_False
  tasks:
     - add_host:  key=my_new_dynamic_group_alias

Note that this would only happen in memory, to do other things, you might wish to use the ec2_tag module to assign new tags as well.

Hope this helps and let me know if there are any questions!




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3d24cd67-5027-407b-a3f5-633869e710ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages