On Thu, Jan 15, 2015 at 4:30 PM, <[email protected]> wrote: > Hi, > > After instance launched using ec2_asg , I wish to add newly created > instance to ansible control machin's host group. > I need to get the public ip and public dns of launched instances. > > I wonder , if registering the ec2_asg output to a list , say asg_result and > then getting the ip (item.public_ip) as asg_result.instances will work ? > > Please let me know the best practices for the same .
Have you considered using the ec2 dynamic inventory plugin with tags? Instead of adding the public ip's to the inventory, ansible can return a list of them of the machines with a given tag. See [1] for the documentation about it. It can also return the ip's based on other information, such as security groups, etc. [1]: http://docs.ansible.com/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script -- Ivan Sichmann Freitas GNU/Linux user #509059 SDF MetaArpa Member http://isf.sdf.org/about.html -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAG2tFJwHuocRZF7DxE0PxYjFHzhsk3YqqwsJ49pgOBxGa_Dg-Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
