I posted this as a bug (https://github.com/ansible/ansible/issues/11102). 
But it was closed saying it was a discussion. Not sure why, seems like a 
clear bug to me. But I'm open to be dissuaded. 

----

Ansible 1.9.1 running from OSX.
in playbook

- role: mongodb
  mongodb_replica_set_name: "{{mongodb_rs_name}}"
  mongodb_replica_set_hosts: "{{groups.mongod_rs_member}}"

mongodb role

- set_fact:
    mongodb_candidate_master: "{{mongodb_replica_set_hosts[0]}}"
  run_once: true

- shell: echo "HELLO groups.mongod_rs_member +++++++++++++++++"
  delegate_to: "{{groups.mongod_rs_member[0]}}"
  run_once: true

- shell: echo "HELLO mongodb_candidate_master +++++++++++++++++"
  delegate_to: "{{mongodb_candidate_master}}"
  run_once: true

- shell: echo "HELLO mongodb_replica_set_hosts +++++++++++++++++"
  delegate_to: "{{mongodb_replica_set_hosts[0]}}"
  run_once: true

output

TASK: [mongodb | shell echo "HELLO groups.mongod_rs_member +++++++++++++++++"] 
***
<10.0.139.56> ESTABLISH CONNECTION FOR USER: ubuntu
<10.0.139.56> REMOTE_MODULE command echo "HELLO groups.mongod_rs_member 
+++++++++++++++++" #USE_SHELL
<10.0.139.56> EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=30m -o 
ControlPath="/Users/bkaplan/.ansible/cp/ansible-ssh-%h-%p-%r" -o 
StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 10.0.139.56 
/bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, 
key=enrekuxbmqjtjdgsxvlukuvqlhnudrkw] password: " -u root /bin/sh -c '"'"'echo 
BECOME-SUCCESS-enrekuxbmqjtjdgsxvlukuvqlhnudrkw; LANG=en_US.UTF-8 
LC_CTYPE=en_US.UTF-8 /usr/bin/python'"'"''
changed: [10.0.139.56 -> 10.0.139.56] => {"changed": true, "cmd": "echo \"HELLO 
groups.mongod_rs_member +++++++++++++++++\"", "delta": "0:00:00.005216", "end": 
"2015-05-31 04:13:32.378158", "rc": 0, "start": "2015-05-31 04:13:32.372942", 
"stderr": "", "stdout": "HELLO groups.mongod_rs_member +++++++++++++++++", 
"warnings": []}

TASK: [mongodb | shell echo "HELLO mongodb_candidate_master +++++++++++++++++"] 
***
<10.0.139.56> ESTABLISH CONNECTION FOR USER: ubuntu
<10.0.139.56> REMOTE_MODULE command echo "HELLO mongodb_candidate_master 
+++++++++++++++++" #USE_SHELL
<10.0.139.56> EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=30m -o 
ControlPath="/Users/bkaplan/.ansible/cp/ansible-ssh-%h-%p-%r" -o 
StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 10.0.139.56 
/bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, 
key=xnkqbskjckeetqglyftpndfusnsyhoyq] password: " -u root /bin/sh -c '"'"'echo 
BECOME-SUCCESS-xnkqbskjckeetqglyftpndfusnsyhoyq; LANG=en_US.UTF-8 
LC_CTYPE=en_US.UTF-8 /usr/bin/python'"'"''
changed: [10.0.139.56 -> 10.0.139.56] => {"changed": true, "cmd": "echo \"HELLO 
mongodb_candidate_master +++++++++++++++++\"", "delta": "0:00:00.005059", 
"end": "2015-05-31 04:13:33.277391", "rc": 0, "start": "2015-05-31 
04:13:33.272332", "stderr": "", "stdout": "HELLO mongodb_candidate_master 
+++++++++++++++++", "warnings": []}

TASK: [mongodb | shell echo "HELLO mongodb_replica_set_hosts 
+++++++++++++++++"] ***
<{> ESTABLISH CONNECTION FOR USER: ubuntu
<{> REMOTE_MODULE command echo "HELLO mongodb_replica_set_hosts 
+++++++++++++++++" #USE_SHELL
<{> EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=30m -o 
ControlPath="/Users/bkaplan/.ansible/cp/ansible-ssh-%h-%p-%r" -o 
StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o 
PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 { /bin/sh -c 
'sudo -k && sudo -H -S -p "[sudo via ansible, 
key=mqgojxehsqcpahfvfcdimgoedvygtvvb] password: " -u root /bin/sh -c '"'"'echo 
BECOME-SUCCESS-mqgojxehsqcpahfvfcdimgoedvygtvvb; LANG=en_US.UTF-8 
LC_CTYPE=en_US.UTF-8 /usr/bin/python'"'"''
fatal: [10.0.139.56 -> {] => SSH Error: data could not be sent to the remote 
host. Make sure this host can be reached over ssh

-- 
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/9287a30a-c20b-4896-a76d-bcdd21a27319%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to