From 3f3e3e3d5bdf042a0ef733477673fa703d97ccba Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 27 Jan 2016 12:48:15 -0800 Subject: [PATCH] Return an error when synchronize is used with something other than an ssh connection Suggested in #2832 --- lib/ansible/plugins/action/synchronize.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/plugins/action/synchronize.py b/lib/ansible/plugins/action/synchronize.py index c0b50eff97..bbd67dffec 100644 --- a/lib/ansible/plugins/action/synchronize.py +++ b/lib/ansible/plugins/action/synchronize.py @@ -157,6 +157,13 @@ class ActionModule(ActionBase): except (AttributeError, KeyError): delegate_to = None + # ssh paramiko and local are fully supported transports. Anything + # else only works with delegate_to + if delegate_to is None and self._play_context.connection not in ('ssh', 'paramiko', 'smart', 'local'): + result['failed'] = True + result['msg'] = "synchronize uses rsync to function. rsync needs to connect to the remote host via ssh or a direct filesystem copy. This remote host is being accessed via %s instead so it cannot work." % self._play_context.connection + return result + use_ssh_args = self._task.args.pop('use_ssh_args', None) # Parameter name needed by the ansible module