The default inventory has its limitations, but that's exactly why Ansible supports dynamic inventory plugins, which are straightforward to write.
That said, you can use a form of patterns in static inventory, though I don't know if it expands beyond simple numeric and character ranges. On 4 January 2015 at 23:18, Guillaume Subiron <[email protected]> wrote: > Le 15/01/04 12:34, Francisco Reyes claviotta : > > On Monday, December 15, 2014 10:13:18 AM UTC-5, Guillaume Subiron wrote: > > > > > > I manage multiple clients, and my servers are named using the following > > > > > > > > Nope. Patterns can only be used when calling ansible. It would be > awesome to use the same syntax in host definition, but we can't. > > > In addition to the suggestion of using patterns, which sounds like what > you > > were looking for, perhaps another option may be to use different host > files. > > > > I also use ansible for clients, but my clients requirements are so > > different that other than some common roles the hosts are too different. > > > > Are your client machines all similar? Is it something like the same type > of > > setup for multiple clients? > > Yes, all my clients have the same needs. Of course I have some > specific playbooks that can only be used on one client (like deploying > an app), but the majority is common. > > The typical example is the playbook which creates Unix accounts. It is > using a list "admins" in the inventory. This list is declared in > group_vars/ for all my clients (group_vars/foo, group_vars/bar…). > > So what I'm looking for is to include foo-* servers in the "foo" > group, without having to list them one by one. > > > But I have read all the source code of the inventory, and my > conclusion is that it's not possible. This is not the first time I > feel disappointed by the inventory of Ansible. I really love > everything else, but the inventory becomes completely unusable when it > grows. > > So I wrote a new inventory parser. I will submit it on Github soon. > > > Thanks for your answers. > > > -- > Guillaume Subiron > Mail - [email protected] > GPG - 5BC2 EADB > Jabber - [email protected] > IRC - maethor@(freenode|geeknode) > > -- > 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/20150104211810.GA16870%40subiron.org > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAAnNz0MciWdJFU_D_0HMEhqh5D9akcuiUjONtAMvFAttzBFyZw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
