Hi,

I am trying to write a task to be executed over 4 groups. 2 of them are 
based on location 'sb' 'ada' and 2 of them based on distribution. each 
combination has separate template.
sb - redhat - template 1
sb - aix      - template 2
ada - redhat - template 3
ada - aix     - template 4

hosts
[redhat]
redhat1
redhat2

[sb]
sdbcf1
aix2
aix2

However when I am executing the tasks with the template module using 'when' 
as below. The challenge is, the tasks are being run on 1st group the 
distribution and are being skipped on the second condition. Where I want 
the task to be in run only when a server is in both the groups not just 
one.In this case I dont have a a server thats common. HOw can this be done 
? What am I doing wrong ? 

- name: Copying our rsyslog template to Redhat servers in sb
  template: src=rsyslog.conf.sb.lx.j2
                dest=/etc/rsyslog.conf.test
                owner=root
                mode=0600
  when: (ansible_distribution == "RedHat"  and  "'sb' in {{group_names}}")
  notify:  restart rsyslog



-- 
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/4f8b8ae3-8f89-4a2a-be94-3decb24d9de0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to