Hi Dominic: To support mixing static with dynamic inventory, have the "hostfile" entry in your ansible.cfg point to a directory instead of a file. For example, my ansible.cfg contains:
[defaults] hostfile = inventory And my inventory directory looks like this: inventory/hosts inventory/ec2.py inventory/ec2.ini The inventory/hosts file is a static Ansible inventory file. The inventory/ec2.py and inventory/ec2.ini are the dynamic inventory parts. You can edit ec2.ini to specify which regions you want, the example ec2.ini file that ships with ansible is pretty clear on how to do this. I gave a talk on this topic a few months back, the slides may not mean too much without me talking (they're pretty sparse) but here they are: http://go-talks.appspot.com/github.com/lorin/camp-devops-talk/talk.slide You can provision instances using the ec2 module. I recommend that you use tags when you do provisioning because ec2.py will automatically create groups based on tags. One gotcha here is that ec2.py will cache by default, so if you want to launch an instance and then configure it immediately after it comes up, you'll need to disable caching before in ec2.ini (set cache_max_age=0). If you want to do "Australian transporters in production", I don't think you can actually define a new group as an intersection of groups, so you'd have to specify the hosts by explicitly doing the intersection of groups: hosts: australia:&transports:&production (where "australia", "transports" and "production" are all groups that I have assumed you have created via tags). On Monday, August 11, 2014 3:21:47 AM UTC-4, Dominic Bou-Samra wrote: > > Hi all, > > I've been playing with Ansible as a solution to our deployment > infrastructure. Our stack is: > > - Dozens of "transporters" running on EC2. > - Dozens of "detectors" running on EC2 > - Production and staging environments > - Multiple regions (atm US East and Sydney) > > What I require from Ansible is: > > - A dynamic inventory, MIXED IN with a static group declaration. I > would like to be able to refer to my "Australian transporters in > production", as easily as possible. I would like no IP's/hostnames stored > locally (i.e, use EC2.py as a dynamic inventory). > - Ability to provision new EC2 instances in any region, in any > environment. > - As little duplication as possible. > > I am struggling with trying to lay my project out so that I can achieve > these goals. > > > Could anyone provide me with some suggestions or example layouts, ideally > with sample command? Let me know if you need more information and what I > have so far > -- 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/3095ac98-923a-4dcc-8740-d630bfb84227%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
