When executed ansible playbook it does not have any effect on the hosts 
mentioned.

I investigated with -vvv and found that it connects to another ec2 instance 
than intended.

I the example below, I created a file "/home/ubuntu/hello" intentionally on 
wrong ec2 instance and it proved me right.


Expected: error on TASK [command] but it succeeds.


Following is the output.

I want to connect to *10.224.149.135 *also mentioned in "hosts:" in the 
playbook but it always connects to *10.224.149.183*


Any help would be greatly appreciated. I tried my best over last couple of 
days but nothing seems to work. Thanks in advance.


---- output ----


ansible-playbook -i ec2.py -u ubuntu setup_elastalert.yml -vvv

Using /etc/ansible/ansible.cfg as config file

2 plays in setup_elastalert.yml


PLAY 
***************************************************************************


TASK [setup] 
*******************************************************************

*<10.224.149.183>* ESTABLISH SSH CONNECTION FOR USER: ubuntu

<10.224.149.183> SSH: EXEC ssh -C -q -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o 
ControlPath=/home/ashish/.ansible/cp/ansible-ssh-%h-%p-%r -tt 
10.224.149.183 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1460220809.57-210960874166618 `" && echo "` 
echo $HOME/.ansible/tmp/ansible-tmp-1460220809.57-210960874166618 `" )'"'"''

<10.224.149.183> PUT /tmp/tmpmwvkVs TO 
/home/ubuntu/.ansible/tmp/ansible-tmp-1460220809.57-210960874166618/setup

<10.224.149.183> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o 
ControlPath=/home/ashish/.ansible/cp/ansible-ssh-%h-%p-%r '[10.224.149.183]'

<10.224.149.183> ESTABLISH SSH CONNECTION FOR USER: ubuntu

<10.224.149.183> SSH: EXEC ssh -C -q -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o 
ControlPath=/home/ashish/.ansible/cp/ansible-ssh-%h-%p-%r -tt 
10.224.149.183 '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 
LC_MESSAGES=en_US.UTF-8 /usr/bin/python 
/home/ubuntu/.ansible/tmp/ansible-tmp-1460220809.57-210960874166618/setup; 
rm -rf 
"/home/ubuntu/.ansible/tmp/ansible-tmp-1460220809.57-210960874166618/" > 
/dev/null 2>&1'"'"''

*ok: [10.224.149.135]*


TASK [command] 
*****************************************************************

*task path: /home/ashish/gapi-ansible/setup_elastalert.yml:4*

<10.224.149.183> ESTABLISH SSH CONNECTION FOR USER: ubuntu

<10.224.149.183> SSH: EXEC ssh -C -q -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o 
ControlPath=/home/ashish/.ansible/cp/ansible-ssh-%h-%p-%r -tt 
10.224.149.183 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo 
$HOME/.ansible/tmp/ansible-tmp-1460220811.97-107910480855735 `" && echo "` 
echo $HOME/.ansible/tmp/ansible-tmp-1460220811.97-107910480855735 `" )'"'"''

<10.224.149.183> PUT /tmp/tmpKDUOeZ TO 
/home/ubuntu/.ansible/tmp/ansible-tmp-1460220811.97-107910480855735/command

<10.224.149.183> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o 
ControlPath=/home/ashish/.ansible/cp/ansible-ssh-%h-%p-%r '[10.224.149.183]'

<10.224.149.183> ESTABLISH SSH CONNECTION FOR USER: ubuntu

<10.224.149.183> SSH: EXEC ssh -C -q -o ControlMaster=auto -o 
ControlPersist=60s -o KbdInteractiveAuthentication=no -o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 -o 
ControlPath=/home/ashish/.ansible/cp/ansible-ssh-%h-%p-%r -tt 
10.224.149.183 '/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 
LC_MESSAGES=en_US.UTF-8 /usr/bin/python 
/home/ubuntu/.ansible/tmp/ansible-tmp-1460220811.97-107910480855735/command; 
rm -rf 
"/home/ubuntu/.ansible/tmp/ansible-tmp-1460220811.97-107910480855735/" > 
/dev/null 2>&1'"'"''

changed: [10.224.149.135] => {"changed": true, "cmd": ["cat", 
"/home/ubuntu/world"], "delta": "0:00:00.001523", "end": "2016-04-09 
16:53:33.677920", "invocation": {"module_args": {"_raw_params": "cat 
/home/ubuntu/world", "_uses_shell": false, "chdir": null, "creates": null, 
"executable": null, "removes": null, "warn": true}, "module_name": 
"command"}, "rc": 0, "start": "2016-04-09 16:53:33.676397", "stderr": "", 
"stdout": "Hello", "stdout_lines": ["Hello"], "warnings": []}


---- end of excerpt. Bailed out ^C ----

-- 
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/97d5060a-bc26-4907-b008-7e613396f852%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to