summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/action/synchronize.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/plugins/action/synchronize.py')
-rw-r--r--lib/ansible/plugins/action/synchronize.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ansible/plugins/action/synchronize.py b/lib/ansible/plugins/action/synchronize.py
index 2670cc9290..45004d5ed4 100644
--- a/lib/ansible/plugins/action/synchronize.py
+++ b/lib/ansible/plugins/action/synchronize.py
@@ -131,7 +131,10 @@ class ActionModule(ActionBase):
src_host = '127.0.0.1'
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)
+ try:
+ dest_host = dest_host_inventory_vars['ansible_host']
+ except KeyError:
+ dest_host = dest_host_inventory_vars.get('ansible_ssh_host', inventory_hostname)
dest_is_local = dest_host in C.LOCALHOST