From 6c107258fad96fca53bea5a74960f54ac0d7b45e Mon Sep 17 00:00:00 2001 From: Gaurav Jain Date: Sun, 6 Sep 2015 22:16:03 -0700 Subject: [PATCH] Fix rsync connections to IPv6 addresses Similar to https://github.com/ansible/ansible/pull/11816 we can unconditionally wrap the host address in square brackets. This is required by rsync for IPv6 addresses. --- lib/ansible/plugins/action/synchronize.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/plugins/action/synchronize.py b/lib/ansible/plugins/action/synchronize.py index cd7d9fd27c6..f9a4b49bb7b 100644 --- a/lib/ansible/plugins/action/synchronize.py +++ b/lib/ansible/plugins/action/synchronize.py @@ -48,9 +48,9 @@ class ActionModule(ActionBase): if host not in C.LOCALHOST: if user: - return '%s@%s:%s' % (user, host, path) + return '%s@[%s]:%s' % (user, host, path) else: - return '%s:%s' % (host, path) + return '[%s]:%s' % (host, path) if ':' not in path and not path.startswith('/'): path = self._get_absolute_path(path=path) @@ -60,9 +60,9 @@ class ActionModule(ActionBase): transport = self._play_context.connection if host not in C.LOCALHOST or transport != "local": if user: - return '%s@%s:%s' % (user, host, path) + return '%s@[%s]:%s' % (user, host, path) else: - return '%s:%s' % (host, path) + return '[%s]:%s' % (host, path) if ':' not in path and not path.startswith('/'): path = self._get_absolute_path(path=path)