I have this task in a play for group 'dbservers':

name: test
debug: msg='{{ is_master }}'
sudo: true
sudo_user: postgres
when: is_master
with_items: groups['dbservers'][1::]

I wrote this because I wanted only master ( which is groups['dbservers'][0] 
with hostname 'pgserver-1' ) to show the message for every slave. 

With 1 master and 1 slave it doesn't work:

TASK: [database | test] 
******************************************************* 
<....> ESTABLISH CONNECTION FOR USER: root
<....> ESTABLISH CONNECTION FOR USER: root
ok: [pgserver-2] => (item=pgserver-2) => {
"item": "pgserver-2", 
"msg": "False"
}
ok: [pgserver-1] => (item=pgserver-2) => {
"item": "pgserver-2", 
"msg": "True"
}

The first message shouldn't be shown but be skipped. It's like when isn't 
working, but is_master is correctly evaluated based on the hostname.What am 
i doing wrong?

-- 
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/3f335e44-41c0-4f5a-b857-7b3c7fb391f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to