Ansible version: 1.2 (one hour ago)
In ansible.cfg
transport=ssh
remote_user=root
My hosts file:
[lh]
127.0.0.1
My playbook:
- hosts: lh
sudo: yes
tasks:
- name: action echo cat
action: shell echo
pwd
sudo: no
- name: local_action echo cat
local_action: shell echo
pwd
In ansible version 0.9 this is working (just tested it now), but from version 1.0 and up I git this output (see below for version 0.9 output):
$ ansible-playbook -vvv -i hosts main.yml
PLAY [lh] *********************
GATHERING FACTS *********************
<127.0.0.1> ESTABLISH CONNECTION FOR USER: root
<127.0.0.1> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, u’User=root’, ‘127.0.0.1’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1370612111.97-208758030915962 && echo $HOME/.ansible/tmp/ansible-1370612111.97-208758030915962’”]
<127.0.0.1> REMOTE_MODULE setup
<127.0.0.1> PUT /tmp/tmp9gMKCJ TO /root/.ansible/tmp/ansible-1370612111.97-208758030915962/setup
<127.0.0.1> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, u’User=root’, ‘127.0.0.1’, u’/bin/sh -c 'sudo -k && sudo -H -S -p “[sudo via ansible, key=oxdyeugepbnkmhdeqvitdlovehtgdtlk] password: " -u root /bin/sh -c '”'“'/usr/bin/python /root/.ansible/tmp/ansible-1370612111.97-208758030915962/setup; rm -rf /root/.ansible/tmp/ansible-1370612111.97-208758030915962/ >/dev/null 2>&1'”'"''']
ok: [127.0.0.1]
TASK: [action echo cat] *********************
<127.0.0.1> ESTABLISH CONNECTION FOR USER: root
<127.0.0.1> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, u’User=root’, ‘127.0.0.1’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1370612113.2-67083879678603 && echo $HOME/.ansible/tmp/ansible-1370612113.2-67083879678603’”]
<127.0.0.1> REMOTE_MODULE command echo pwd
#USE_SHELL
<127.0.0.1> PUT /tmp/tmpRFbADf TO /root/.ansible/tmp/ansible-1370612113.2-67083879678603/command
<127.0.0.1> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, u’User=root’, ‘127.0.0.1’, u"/bin/sh -c ‘/usr/bin/python /root/.ansible/tmp/ansible-1370612113.2-67083879678603/command; rm -rf /root/.ansible/tmp/ansible-1370612113.2-67083879678603/ >/dev/null 2>&1’"]
changed: [127.0.0.1] => {“changed”: true, “cmd”: "echo pwd
", “delta”: “0:00:00.002072”, “end”: “2013-06-07 15:35:13.293487”, “rc”: 0, “start”: “2013-06-07 15:35:13.291415”, “stderr”: “”, “stdout”: “/root”}
TASK: [local_action echo cat] *********************
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-1370612113.33-211012426160008 && chmod a+rx $HOME/.ansible/tmp/ansible-1370612113.33-211012426160008 && echo $HOME/.ansible/tmp/ansible-1370612113.33-211012426160008’]
<127.0.0.1> REMOTE_MODULE command echo pwd
#USE_SHELL
<127.0.0.1> PUT /tmp/tmpK7pZ7w TO /home/frans/.ansible/tmp/ansible-1370612113.33-211012426160008/command
<127.0.0.1> EXEC /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=pguxyoywxnpgyudsxxwocmmqzrwoxivc] password: " -u root /bin/sh -c '”’“‘/usr/bin/python /home/frans/.ansible/tmp/ansible-1370612113.33-211012426160008/command; rm -rf /home/frans/.ansible/tmp/ansible-1370612113.33-211012426160008/ >/dev/null 2>&1’”‘"’’
failed: [127.0.0.1] => {“failed”: true, “parsed”: false}
FATAL: all hosts have already failed – aborting
PLAY RECAP *********************
127.0.0.1 : ok=2 changed=1 unreachable=0 failed=1
The utput in ansible version 0.9 is:
ansible-playbook -vvv -i hosts main.yml
PLAY [lh] *********************
GATHERING FACTS *********************
<127.0.0.1> ESTABLISH CONNECTION FOR USER: root
<127.0.0.1> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, u’User=root’, ‘127.0.0.1’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1370612945.32-217398837952549 && echo $HOME/.ansible/tmp/ansible-1370612945.32-217398837952549’”]
<127.0.0.1> REMOTE_MODULE setup
<127.0.0.1> PUT /tmp/tmpij5ter TO /root/.ansible/tmp/ansible-1370612945.32-217398837952549/setup
<127.0.0.1> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, u’User=root’, ‘127.0.0.1’, u’/bin/sh -c 'sudo -k && sudo -p “[sudo via ansible, key=wgvrtasdgrevksimahiwfraztcbiaqbi] password: " -u root /bin/sh -c '”'“'/usr/bin/python /root/.ansible/tmp/ansible-1370612945.32-217398837952549/setup; rm -rf /root/.ansible/tmp/ansible-1370612945.32-217398837952549/ >/dev/null 2>&1'”'"''']
ok: [127.0.0.1]
TASK: [action echo cat] *********************
<127.0.0.1> ESTABLISH CONNECTION FOR USER: root
<127.0.0.1> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, u’User=root’, ‘127.0.0.1’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1370612947.92-130200028444731 && echo $HOME/.ansible/tmp/ansible-1370612947.92-130200028444731’”]
<127.0.0.1> REMOTE_MODULE command echo pwd
#USE_SHELL
<127.0.0.1> PUT /tmp/tmpmFrzxf TO /root/.ansible/tmp/ansible-1370612947.92-130200028444731/command
<127.0.0.1> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, u’User=root’, ‘127.0.0.1’, u"/bin/sh -c ‘/usr/bin/python /root/.ansible/tmp/ansible-1370612947.92-130200028444731/command; rm -rf /root/.ansible/tmp/ansible-1370612947.92-130200028444731/ >/dev/null 2>&1’"]
changed: [127.0.0.1] => {“changed”: true, “cmd”: "echo pwd
", “delta”: “0:00:00.001230”, “end”: “2013-06-07 15:49:08.012663”, “rc”: 0, “start”: “2013-06-07 15:49:08.011433”, “stderr”: “”, “stdout”: “/root”}
TASK: [local_action echo cat] *********************
<127.0.0.1> EXEC mkdir -p $HOME/.ansible/tmp/ansible-1370612948.06-212987873710907 && chmod a+rx $HOME/.ansible/tmp/ansible-1370612948.06-212987873710907 && echo $HOME/.ansible/tmp/ansible-1370612948.06-212987873710907
<127.0.0.1> REMOTE_MODULE command echo pwd
#USE_SHELL
<127.0.0.1> PUT /tmp/tmpO9Uls6 TO /home/frans/.ansible/tmp/ansible-1370612948.06-212987873710907/command
<127.0.0.1> EXEC sudo -u root -s /usr/bin/python /home/frans/.ansible/tmp/ansible-1370612948.06-212987873710907/command; rm -rf /home/frans/.ansible/tmp/ansible-1370612948.06-212987873710907/ >/dev/null 2>&1
changed: [127.0.0.1] => {“changed”: true, “cmd”: "echo pwd
", “delta”: “0:00:00.001365”, “end”: “2013-06-07 15:49:08.116814”, “rc”: 0, “start”: “2013-06-07 15:49:08.115449”, “stderr”: “”, “stdout”: “/home/frans/modules/ansible-playbooks/testing”}
PLAY RECAP *********************
127.0.0.1 : ok=3 changed=2 unreachable=0 failed=0