I saw this in the ansible-examples / openshift / openshift_ec2 / roles / 
mongodb / tasks / main.yml  

- name: Initialize the replication set
  shell: /usr/bin/mongo --port "{{ mongod_port }}" 
/tmp/repset_init.js;touch /opt/rep.init creates=/opt/rep.init
  when: inventory_hostname ==  groups['mongo_servers'][0]


What does the [0] mean in   when: inventory_hostname == 
 groups['mongo_servers'][0]   ?

I wanted to find a conditional that would say:   when inventory_hostname is 
not in group mailservers

It seems to work for me with this now:

  when: inventory_hostname != groups['mailservers'][0]

But I just don't understand what the syntax means.

Thanks!

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to