Creating Dynamic Inventory with CloudFormation Outputs

369 views
Skip to first unread message

divya mangotra

unread,
Jun 17, 2016, 9:25:35 AM6/17/16
to Ansible Project
I am using AWS CloudFormation to create infrastructure and the template creates EC2 instances, Elasticache cluster and RDS instance. Now, I am wondering as to how to use the CloudFormation outputs to create Ansible Dynamic Inventory? In the static inventory files I also have groups of groups. How do I tweak my ec2.ini and ec2.py to accomodate the same?

Mocking Bird

unread,
Jun 28, 2016, 6:03:38 AM6/28/16
to Ansible Project
I have the same question. Why there isn't any answer here?

Stephen Granger

unread,
Jun 28, 2016, 2:04:56 PM6/28/16
to ansible...@googlegroups.com
Just a quick response, some what self promoting but hopefully helpful.

cloudformation_facts module

I'd previously put together a lookup plugin (mainly through combining others efforts)
https://github.com/ansible/ansible/pull/12880
I'm going to make the time to rewrite this using boto3 and try and get it completed before the end of July.

This will give you the resources that were created by the cloudformation stacks. It's also possible to use the ec2_facts, http://docs.ansible.com/ansible/ec2_facts_module.html and  ec2_remote_facts http://docs.ansible.com/ansible/ec2_remote_facts_module.html to get a list of the ec2 instances and then iterate them through through the add_host http://docs.ansible.com/ansible/add_host_module.html to add them to an in-memory inventory.


--
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/0b74b57c-0228-41bc-a2df-a520d2dcb943%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Steve
Reply all
Reply to author
Forward
0 new messages