when: '"web-server" in group_names' group_names is an array/list so you have to check if 'web-server' exists within it.
On Sunday, November 15, 2015, Adithya Khamithkar <[email protected]> wrote: > Hi, > > I would like to use the when condition to execute tasks based on group > names in ansible. > > I am using this code snipit > > when: ({{group_names}} == "web-server") > > But it always skips. > > Can someone please correct me. > > -- > 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] > <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/da3e21ec-38f5-44d2-ab6d-a1fc62f9866c%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/da3e21ec-38f5-44d2-ab6d-a1fc62f9866c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Matt Martz @sivel sivel.net -- 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/CAD8N0v_J46vR8NOYh%2BBhy0%2ByhyUjTDjREXMb3sqPtOjPynVU%2Bg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
