rsync works but synchronize errors

1,491 views
Skip to first unread message

Brian Grossman

unread,
Apr 21, 2014, 5:42:12 PM4/21/14
to ansible...@googlegroups.com
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='<<CHANGED>>%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='<<CHANGED>>%i %n%L' /home/mumble/.ansible/PB-dpc/working/mumble-bin/ ad...@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=<<CHANGED>>%i %n%L", "/home/mumble/.ansible/PB-dpc/working/mumble-bin/", "ad...@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='<<CHANGED>>%i %n%L' /home/mumble/.ansible/PB-dpc/working/mumble-bin/ ad...@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

kesten broughton

unread,
Apr 23, 2014, 9:05:16 AM4/23/14
to ansible...@googlegroups.com
I was having similar problems in a similar env (ansible 1.6 / centos 6.5) and haven't gotten it completely working yet.
A few questions:

Do you have the ansible_ssh_private_key set in your hosts file (since the synchronize spec doesn't expose -i option)?
Your command is sudo for rsync (sudo: no but rsync path adds it back) but not for synchonize.   I think running ansible as sudo, I noticed ssh was looking for keys in /var/root/.ssh instead of your home directory.
Your rsync command is specifying the user admin@ but i don't see that in the syncrhonize command unless your playbook is running as remote_user: admin or something.
Have you tried running with -c ssh?

kesten

Michael DeHaan

unread,
Apr 23, 2014, 9:06:01 AM4/23/14
to ansible...@googlegroups.com
"This is with ansible 1.5.3 on centos 6.4.  Using paramiko for transport. "

What OS are you running from?

Ubuntu 14.04 has/had a known bug in rsync's io.c (not ansible) where it can't talk to older hosts.

Search google for the io.c error and you'll see a few references.


--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0573f27b-16af-4759-a27b-a8e0498eaaf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Grossman

unread,
Apr 24, 2014, 6:05:30 PM4/24/14
to ansible...@googlegroups.com
I don't have the key specified in my hosts file, but the -vvv looks like synchronize passes it along correctly.

I do have remote_user=admin in my ansible.cfg.  And I specify that private_key_file in ansible.cfg.

When I try using ssh as transport instead of paramiko, I get "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh".  I assume that's because I'm running on centos, which still suffers from an ancient openssh's lack of Control Persist.

Brian

Brian Grossman

unread,
Apr 24, 2014, 6:06:12 PM4/24/14
to ansible...@googlegroups.com
Both sides are running centos 6.4.

Would that io.c problem apply if rsync by itself works?

Brian

Michael DeHaan

unread,
Apr 25, 2014, 4:37:44 PM4/25/14
to ansible...@googlegroups.com
io.c errors are beyond our control as far as I'm aware.

You may wish to just use the recursive copy options instead.




Brian Grossman

unread,
May 7, 2014, 12:34:41 PM5/7/14
to ansible...@googlegroups.com
I wound up just calling out to rsync and living with the complexity that brings.  In future, I expect I'll probably remove the .svn and .git directories as part of staging the content; then I can use a straight copy instead of synchronize or rsync.

I'm not convinced it's the io.c problem Michael mentions though.  Both sides of the rsync are centos 6.4.  Given the ssh "Permission denied" complaints that preceed the io.c error, I'm inclined to suspect the --rsh option is somehow not retaining quotes around its arguments, so missing ssh's -i argument.  Baffling...
Reply all
Reply to author
Forward
0 new messages