I have a synchronize task and an rsync command task that I think should be equivalent. The rsync works, but the synchronize doesn’t. Can anyone help me make synchronize work?
This is with ansible 1.5.3 on centos 6.4. Using paramiko for transport. TTY-less sudo works.
I don’t want to use the copy module because I want to skip over .svn directories, and it doesn’t have anything like the .rsync-filter file.
(Loving ansible, BTW.)
rsync task:
- name: my copy in bin dir
sudo: no
local_action: >
command
rsync
–delay-updates -FF --compress --timeout=10 --delete-after
–archive --no-owner --no-group
–rsh ‘ssh -i /home/mumble/.ansible/keys/mumble-id_rsa -o stricthostkeychecking=no’
–rsync-path ‘sudo rsync’
–out-format=‘<>%i %n%L’
{{ inventory_dir }}/working/mumble-bin/
admin@{{ inventory_hostname }}:/mumble/bin
synchronize task:
- name: copy in bin dir
synchronize: >
owner=no group=no delete=yes
src={{ inventory_dir }}/working/digimarc-bin/
dest=/digimarc/bin
Here’s the ansible-playbook -vvv output from them. I notice that the rsync local_action task splits the cmd into an array, while the synchronize task doesn’t. Aside from that, I’m utterly mystified. If I copy the synchronize cmd to my terminal it works just fine.
rsync:
TASK: [mumble-bin | my copy in bin dir] *************************************
<127.0.0.1> REMOTE_MODULE command rsync --delay-updates -FF --compress --timeout=10 --delete-after --archive --no-owner --no-group --rsh ‘ssh -i /home/mumble/.ansible/keys/mumble-id_rsa -o stricthostkeychecking=no’ --rsync-path ‘sudo rsync’ --out-format=‘<>%i %n%L’ /home/mumble/.ansible/PB-dpc/working/mumble-bin/ admin@ops001.mumble.com:/mumble/bin
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1398114848.9-199337421744003 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1398114848.9-199337421744003 && echo $HOME/.ansible/tmp/ansible-tmp-1398114848.9-199337421744003’]
<127.0.0.1> PUT /tmp/tmpFEn0En TO /home/mumble/.ansible/tmp/ansible-tmp-1398114848.9-199337421744003/command
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘/usr/bin/python /home/mumble/.ansible/tmp/ansible-tmp-1398114848.9-199337421744003/command; rm -rf /home/mumble/.ansible/tmp/ansible-tmp-1398114848.9-199337421744003/ >/dev/null 2>&1’]
changed: [ops001.mumble.com] => {“changed”: true, “cmd”: [“rsync”, “–delay-updates”, “-FF”, “–compress”, “–timeout=10”, “–delete-after”, “–archive”, “–no-owner”, “–no-group”, “–rsh”, “ssh -i /home/mumble/.ansible/keys/mumble-id_rsa -o stricthostkeychecking=no”, “–rsync-path”, “sudo rsync”, “–out-format=<>%i %n%L”, “/home/mumble/.ansible/PB-dpc/working/mumble-bin/”, “admin@ops001.mumble.com:/mumble/bin”], “delta”: “0:00:00.348326”, “end”: “2014-04-21 14:14:09.299270”, “item”: “”, “rc”: 0, “start”: “2014-04-21 14:14:08.950944”, “stderr”: “”, “stdout”: “”}
synchronize:
TASK: [mumble-bin | copy in bin dir] ****************************************
<127.0.0.1> ESTABLISH CONNECTION FOR USER: admin on PORT 22 TO 127.0.0.1
<127.0.0.1> EXEC /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1398114849.46-137775062175503 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1398114849.46-137775062175503 && echo $HOME/.ansible/tmp/ansible-tmp-1398114849.46-137775062175503’
<127.0.0.1> PUT /tmp/tmp3awrHX TO /home/admin/.ansible/tmp/ansible-tmp-1398114849.46-137775062175503/synchronize
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python /home/admin/.ansible/tmp/ansible-tmp-1398114849.46-137775062175503/synchronize; rm -rf /home/admin/.ansible/tmp/ansible-tmp-1398114849.46-137775062175503/ >/dev/null 2>&1’
failed: [ops001.mumble.com] => {“cmd”: “rsync --delay-updates -FF --compress --timeout=10 --delete-after --archive --no-owner --no-group --rsh ‘ssh -i /home/mumble/.ansible/keys/mumble-id_rsa -o StrictHostKeyChecking=no’ --rsync-path ‘sudo rsync’ --out-format=‘<>%i %n%L’ /home/mumble/.ansible/PB-dpc/working/mumble-bin/ admin@ops001.mumble.com:/mumble/bin”, “failed”: true, “item”: “”, “rc”: 255}
msg: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6]
Brian