summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2016-01-27 12:48:15 -0800
committerJames Cammarata <jimi@sngx.net>2016-01-28 16:05:12 -0500
commit951fa36fca7bdd9b97fa732bf5b2f88c0db8eaf5 (patch)
tree445c5295143ae5a9c791d3bee9608505d0b75fd2
parent43cf527fe7f4e21fed730236c0e7d11cec732e68 (diff)
downloadansible-951fa36fca7bdd9b97fa732bf5b2f88c0db8eaf5.tar.gz
Return an error when synchronize is used with something other than an ssh connection
Suggested in #2832
-rw-r--r--lib/ansible/plugins/action/synchronize.py7
1 files changed, 7 insertions, 0 deletions
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