From 2288a11b6ad3db89f697020adc3ac0cb5f592083 Mon Sep 17 00:00:00 2001 From: Timothy Appnel Date: Mon, 29 Jul 2013 19:06:14 -0400 Subject: [PATCH] Implemented setup method in rsync action module. --- lib/ansible/runner/action_plugins/synchronize.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ansible/runner/action_plugins/synchronize.py b/lib/ansible/runner/action_plugins/synchronize.py index 4b505d0611..fc6e70f4ab 100644 --- a/lib/ansible/runner/action_plugins/synchronize.py +++ b/lib/ansible/runner/action_plugins/synchronize.py @@ -38,6 +38,11 @@ class ActionModule(object): else: return path + def setup(self, module_name, inject): + ''' Always default to localhost as delegate if None defined ''' + if inject.get('delegate_to') is None: + inject['delegate_to'] = '127.0.0.1' + def run( self, conn, @@ -65,10 +70,6 @@ class ActionModule(object): except KeyError: pass - # the localhost is the default delegate in an rsync task - if inject.get('delegate_to') is None: - conn.delegate = '127.0.0.1' - inject['delegate_to'] = '127.0.0.1' src_host = inject['delegate_to'] dest_host = inject.get('ansible_ssh_host', inject['inventory_hostname']) if options.get('mode', 'push') == 'pull':