Re: [ansible-project] how to run play for subgroup when children has same name

2024-04-25 Thread Todd Lewis
Brian said what to do, but left /how to do it/ as a (very worthwhile) exercise for the reader. It could look something like when: group_names | select('search', '_broker' ) | length > 0 # matches all the broker groups when: group_names | select('search', kenv ~ '_app_zoo') | length >

Re: [ansible-project] how to run play for subgroup when children has same name

2024-04-25 Thread Brian Coca
See `select` (or `reject`) filter with `match` test, you can use it to go over group_names. -- -- Brian Coca (he/him/yo) -- 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

Re: [ansible-project] how to run play for subgroup when children has same name

2024-04-25 Thread Sameer Modak
First of all thanks for solution. I tried this but how do we pass wildcard as group *kafka_qa* in when condition or in j2* On Friday, April 19, 2024 at 8:37:51 PM UTC+5:30 Todd Lewis wrote: > Oops. That second "children:" under "kafka:" shouldn't be there. > Otherwise, it's pretty close. > >

Re: [ansible-project] how to run play for subgroup when children has same name

2024-04-25 Thread Sameer Modak
Hello Team, is there any way to pass wildcard group in ansible when condition or in j2?? because if try with *kafka_qa_*_b as a group in j2 because i want to use this in j2.* *if kafka_qa or any group has zookeeper host then add zookeeper lines else add broker lines.* *it should be common

Re: [ansible-project] how to run play for subgroup when children has same name

2024-04-25 Thread Sameer Modak
That was useful. But i still did not quite get how do we pass *kafka_dev* in j2 or during runtime like we dont know before hand what group we will be running against.* *so in when condition can we pass something like this when group is * *kafka_dev** On Friday, April 19, 2024 at 8:37:51 PM

Re: [ansible-project] how to run play for subgroup when children has same name

2024-04-19 Thread Todd Lewis
Oops. That second "children:" under "kafka:" shouldn't be there. Otherwise, it's pretty close. On Friday, April 19, 2024 at 10:58:32 AM UTC-4 Todd Lewis wrote: > It appears you are trying to define two different "*broker*" groups: one > as a child of the "*dev_kafka_cluster*" and another as a

Re: [ansible-project] how to run play for subgroup when children has same name

2024-04-19 Thread Todd Lewis
It appears you are trying to define two different "*broker*" groups: one as a child of the "*dev_kafka_cluster*" and another as a child of "*qa_kafka_cluster*". That isn't how groups work. There is only one "*broker*" group. You have added hosts to the "*broker*" group in two places. (Also,

[ansible-project] how to run play for subgroup when children has same name

2024-04-19 Thread Sameer Modak
I have an inventory something like this , each main cluster has children like broker. Now how do i run any tasks against perticular group.broker. When we pass the group with --limit it does not work it runs on all broker. Also main playbook has hosts:all in it