From d3d1aa2dca4988bb7a232458338d86a0c9fef06e Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 17 Feb 2017 14:18:41 +0100 Subject: [PATCH] synchronize: quote private_key (#21570) otherwise rsync will fail when trying to access a key with spaces: fatal: [default]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh 'ssh -i /home/user/Some Folder/.vagrant/machines/default/libvirt/private_key -S none -o StrictHostKeyChecking=no -o Port=22' --out-format='<>%i %n%L' \"/etc/issue\" \"vagrant@192.168.121.10:/tmp/issue2\"", "failed": true, "msg": "Warning: Identity file /home/user/Some not accessible: No such file or directory.\nssh: Could not resolve hostname folder/.vagrant/machines/default/libvirt/private_key: No address associated with hostname\r\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]\n", "rc": 255} --- lib/ansible/modules/files/synchronize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/files/synchronize.py b/lib/ansible/modules/files/synchronize.py index f814f2e396..7a8d1e1258 100644 --- a/lib/ansible/modules/files/synchronize.py +++ b/lib/ansible/modules/files/synchronize.py @@ -438,7 +438,7 @@ def main(): if private_key is None: private_key = '' else: - private_key = '-i '+ private_key + private_key = '-i "%s"' % private_key ssh_opts = '-S none'