I also tried using a copy with a delegate_to and that's not working
either (the src couldn't be found). Here's a playbook and the output
from the run:
]$ cat test3.yml
---
- hosts: all
remote_user: sg
sudo: true
tasks:
- name: create remote file
file: path=/tmp/XYZ123 state=touch
delegate_to: '{{ delegate_host }}'
- name: testing delegate copy
copy: src=/tmp/XYZ123 dest=/tmp/ABC456
delegate_to: '{{ delegate_host }}'
]$ ansible-playbook test3.yml -l app1 -e 'delegate_host=10.0.1.86' -vvv
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
<10.0.1.89> ESTABLISH CONNECTION FOR USER: sg on PORT 22 TO 10.0.1.89
<10.0.1.89> REMOTE_MODULE setup
<10.0.1.89> EXEC /bin/sh -c 'mkdir -p
$HOME/.ansible/tmp/ansible-tmp-1400696767.07-233153692139034 && chmod
a+rx $HOME/.ansible/tmp/ansible-tmp-1400696767.07-233153692139034 &&
echo $HOME/.ansible/tmp/ansible-tmp-1400696767.07-233153692139034'
<10.0.1.89> PUT /tmp/tmp6bGYDw TO
/home/sg/.ansible/tmp/ansible-tmp-1400696767.07-233153692139034/setup
<10.0.1.89> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via
ansible, key=bbgqvwdsjhbplqqmobpwlqwybvofjfuw] password: " -u root
/bin/sh -c '"'"'echo SUDO-SUCCESS-bbgqvwdsjhbplqqmobpwlqwybvofjfuw;
LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python
/home/sg/.ansible/tmp/ansible-tmp-1400696767.07-233153692139034/setup;
rm -rf /home/sg/.ansible/tmp/ansible-tmp-1400696767.07-233153692139034/
>/dev/null 2>&1'"'"''
ok: [app1]
TASK: [create remote file] ****************************************************
<10.0.1.86> ESTABLISH CONNECTION FOR USER: sg on PORT 22 TO 10.0.1.86
<10.0.1.86> REMOTE_MODULE file path=/tmp/XYZ123 state=touch
<10.0.1.86> EXEC /bin/sh -c 'mkdir -p
$HOME/.ansible/tmp/ansible-tmp-1400696768.62-116058327340724 && chmod
a+rx $HOME/.ansible/tmp/ansible-tmp-1400696768.62-116058327340724 &&
echo $HOME/.ansible/tmp/ansible-tmp-1400696768.62-116058327340724'
<10.0.1.86> PUT /tmp/tmpvpuHFg TO
/home/sg/.ansible/tmp/ansible-tmp-1400696768.62-116058327340724/file
<10.0.1.86> EXEC /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via
ansible, key=fmymfhqecsgxkmngwtllopvyzgarrtjn] password: " -u root
/bin/sh -c '"'"'echo SUDO-SUCCESS-fmymfhqecsgxkmngwtllopvyzgarrtjn;
LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 /usr/bin/python
/home/sg/.ansible/tmp/ansible-tmp-1400696768.62-116058327340724/file;
rm -rf /home/sg/.ansible/tmp/ansible-tmp-1400696768.62-116058327340724/
>/dev/null 2>&1'"'"''
changed: [app1] => {"changed": true, "dest": "/tmp/XYZ123", "gid": 0,
"group": "root", "mode": "0644", "owner": "root", "size": 0, "state":
"file", "uid": 0}
TASK: [testing delegate copy] *************************************************
<10.0.1.86> ESTABLISH CONNECTION FOR USER: sg on PORT 22 TO 10.0.1.86
failed: [app1] => {"failed": true}
msg: could not find src=/tmp/XYZ123
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/sg/test3.retry
app1 : ok=2 changed=1 unreachable=0 failed=1
I should also note that running this will hang too at the end, but a
single <enter> brings it back to the prompt. Maybe that's connected to
the ssh-inside-ssh problem I'm having as well with STDIN waiting on a
carriage-return somewhere but STDIN not being tied to my terminal...