If you are attempting to talk to only certain instances, usage of the host group specifier "hosts:" is the way to do it.
To talk to all instances ending in that pattern - hosts: *_k The docs also show how to combine patterns and negate them. (The group_by module can also be used to create groups of arbitrary criteria based on facts, but is not needed here) On Thu, Nov 13, 2014 at 6:12 AM, Torsten Reinhard <[email protected]> wrote: > Hi all, > > like probably most of you, we have multiple servers with multiple > application instances (Tomcat, Apache, ..) on it, for example structured > like this: > > [cae:children] > cae-1 > cae-2 > > [cae-1] > pbdelsweb001.mydomain.com > [cae-2] > pbdelsweb002.mydomain.com > > > For each group we have a *.yml file at group_vars directoy in the > inventory: > > cae-1.yml: > --- > cae_instance: > - > index: _1_a > port: 8700 > - > index: _1_b > port: 9700 > - > index: _1_c > port: 10700 > - > index: _1_k > port: 12700 > > All these instances are setup by a simple playbook: > > - hosts: cae > user: myuser > > vars_files: > - vars/stage-{{stage}}.yml > > roles: > - { role: cae-tomcat, params: "{{ cae_instance }}" } > > This is all fine - but now I have to fullfill the requirement to be able > to address only the "_k" instances - or only the "_a" instances - that > meens one or more instances out of the complete list. > > Is there an option to "filter" the list of instances ? Something like > > with_items > - filter: (".*_k" ) > > Do I have to write my own Iterator(s) for this ? > > Thanx for any hints, Torsten > > > > > -- > 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/fbbdc812-3908-43a8-921b-f7705a6314cc%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/fbbdc812-3908-43a8-921b-f7705a6314cc%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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/CA%2BnsWgw%2BbHfevoA1UT0A9FkYfhbgPD5rVdME3uES6LX0UcJghQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
