From 5617f6aad459e9466326316b0207a094d692e409 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 14 Oct 2015 18:55:46 -0700 Subject: [PATCH] Update synchronize to use the correct host when delegating Fixes #12752 --- lib/ansible/plugins/action/synchronize.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/action/synchronize.py b/lib/ansible/plugins/action/synchronize.py index c069505087..cbc4d2ce47 100644 --- a/lib/ansible/plugins/action/synchronize.py +++ b/lib/ansible/plugins/action/synchronize.py @@ -125,7 +125,9 @@ class ActionModule(ActionBase): # running on so localhost could be a non-controller machine if # delegate_to is used) src_host = '127.0.0.1' - dest_host = task_vars.get('ansible_ssh_host') or task_vars.get('inventory_hostname') + inventory_hostname = task_vars.get('inventory_hostname') + dest_host_inventory_vars = task_vars['hostvars'].get(inventory_hostname) + dest_host = dest_host_inventory_vars.get('ansible_ssh_host', inventory_hostname) dest_is_local = dest_host in C.LOCALHOST