diff --git a/lib/ansible/modules/files/synchronize.py b/lib/ansible/modules/files/synchronize.py index 35c755520b..8a43f17b90 100644 --- a/lib/ansible/modules/files/synchronize.py +++ b/lib/ansible/modules/files/synchronize.py @@ -481,7 +481,7 @@ def main(): ssh_cmd_str = ' '.join(shlex_quote(arg) for arg in ssh_cmd) if ssh_args: ssh_cmd_str += ' %s' % ssh_args - cmd.append('--rsh=%s' % ssh_cmd_str) + cmd.append('--rsh=\'%s\'' % ssh_cmd_str) if rsync_path: cmd.append('--rsync-path=%s' % rsync_path)