Hello All, Please help or suggest how I can solve this problem. I will pass
-e group="1" when calling playbook. *Playbook* - file.yml hosts: servers_{{group}} - task: .... ..... *inventory* [servers_grp1] server1 [servers_grp2] server2 .... [mainservers_1:children] [servers_grp1] [servers_grp2] [servers_grp3] [servers_grp4] [mainservers_2:children] [servers_grp5] [servers_grp6] [servers_grp7] [servers_grp8] In Jinja2 template file, I am trying to assign a value to variable "pod_num". But I am unable to get this If (servers_grp1) is in mainservers_1 then pod_num = 2 else pod_num = 4 I tried a couple of things but did not work out. {% if hosts is in groups[mainservers_1] {% set pod_num = 2 %} {% else %} {% set pod_num = 4 %} Thanks for helping and guiding. -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5deef216-51bc-4ae2-b1f0-375074e1de9a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.