6 ms·
I love the concept, but I couldn't figure out how to make the server inventory dynamic. I tag a lot of instances and want to use the AWS API to grab a list of t
by purephase 13y ago
I love the concept, but I couldn't figure out how to make the server inventory dynamic. I tag a lot of instances and want to use the AWS API to grab a list of tagged instances to automatically build the server inventory on execution.
Since the instances are so variable (auto-scaling etc.) I see that as a killer feature. Maybe I have to dig deeper, but I spent some time evaluating it against Chef/Puppet etc. and I couldn't find anything.
- giulianob 13y agoThe folks at the google group or IRC channel are super helpful. Ask there and you will usually get an answer fairly quick.
- bhangm 13y agonot sure how long ago you tried it out, but ansible has an ec2 inventory script bundled along with it, that you can use instead of maintaining static manifests. This script plugs into the AWS API to get you a list of instances and metadata. Along with that, comes all the goodness of tags and pattern matching, so you can do stuff like tag_Name_DB*:&tag_type_slave to select all database slaves (if you had tags called "Name" and "type" for example)
- purephase 13y agoThat's awesome. I just spent some time going through the getting started section for each project so in my haste I missed all the best parts. Back to it!
- bryanlarsen 13y agoIf server manifest is executable, it executes the script rather than reading it.
- purephase 13y agoSeems silly in hindsight to not consider that. ;)
- susi22 13y agoDon't call it "server manifest". It'll confuse people. You mean "inventory". You can dynamically populate "facts" and "inventory". See: https://github.com/ansible-provisioning/ansible-provisioning https://github.com/ansible-provisioning/ansible-provisioning http://jpmens.net/2013/06/18/adapting-inventory-for-ansible/ http://jpmens.net/2013/06/18/adapting-inventory-for-ansible/ Especially for ec2 there is many modules that allows you to do that too. You can easily specify an inventory file which you populates dynamically. There is also a lot being done about this in v1.3. HTH
- purephase 13y agoExcellent! Thanks for letting me know. I'll have to dive back in and check it out.
- mpdehaan2 13y agoYeah check out the API chapter of the docs, there's information about all kinds of dynamic inventory scripts. https://github.com/ansible/ansible/tree/devel/plugins/inventory https://github.com/ansible/ansible/tree/devel/plugins/invent...
- davis_m 13y agoThis is exactly the info I needed for some work I am doing. Thanks!