From dc9b53a6aad6d28b2c9fdd04bb53d860f51688e6 Mon Sep 17 00:00:00 2001 From: jctanner Date: Tue, 14 Jun 2016 20:20:19 -0400 Subject: [PATCH] Add further commentary about synchronize process_remote. (#16292) Addresses #16284 --- 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 20d40e7eb26..7537c7cdd32 100644 --- a/lib/ansible/plugins/action/synchronize.py +++ b/lib/ansible/plugins/action/synchronize.py @@ -85,8 +85,15 @@ class ActionModule(ActionBase): alternative ssh port to a vagrant host.) """ transport = self._connection.transport + # If we're connecting to a remote host or we're delegating to another + # host or we're connecting to a different ssh instance on the + # localhost then we have to format the path as a remote rsync path if host not in C.LOCALHOST or transport != "local" or \ (host in C.LOCALHOST and not port_matches_localhost_port): + # If we're delegating to non-localhost and but the + # inventory_hostname host is localhost then we need the module to + # fix up the rsync path to use the controller's public DNS/IP + # instead of "localhost" if port_matches_localhost_port and host in C.LOCALHOST: self._task.args['_substitute_controller'] = True return self._format_rsync_rsh_target(host, path, user)