Thank you so much dick. It worked flawlessly. There's a just a typo: the extra closing bracket should be removed after proj: debug: var=groups[proj*]*~'-'~subproj~'-lb'] ------> debug: var=groups[proj~'-'~subproj~'-lb']
On Wednesday, January 26, 2022 at 6:15:24 PM UTC+3:30 [email protected] wrote: > Try the below suggestions > > On Wed, 26 Jan 2022 at 15:29, Roshani <[email protected]> wrote: > > > vars: > > proj: 'website' > > subproj: 'front' > > tasks: > > - name: "Show group members" > > debug: msg=?? # Something like: {{groups[{{proj}}-{{subproj}}-lb]}} > > > debug: var=groups[proj]~'-'~subproj~'-lb'] > > > > > - name: "Conditional" > > do something > > when: inventory_hostname in {{groups[{{proj}}-{{subproj}}-lb]}} > > when: "inventory_hostname in groups[proj ~ '-' ~ subproj ~ '-lb' ]" > > > -- > Dick Visser > Trust & Identity Service Operations Manager > GÉANT > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6468cdcc-490b-4062-af8e-cc1805a14b6bn%40googlegroups.com.
