Added handling ansible_ssh_host the same as ansible_host

- Fixes #298
This commit is contained in:
Hideki Saito 2022-01-28 10:51:58 +00:00
parent 68e7ddb7a7
commit 6e74dae76e
2 changed files with 7 additions and 3 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- synchronize - handle ansible_ssh_host the same as ansible_host (https://github.com/ansible-collections/ansible.posix/issues/298).

View file

@ -235,10 +235,11 @@ 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_host', inventory_hostname)
dest_host = dest_host_inventory_vars.get('ansible_host') or \
dest_host_inventory_vars.get('ansible_ssh_host', inventory_hostname)
dest_host_ids = [hostid for hostid in (dest_host_inventory_vars.get('inventory_hostname'),
dest_host_inventory_vars.get('ansible_host'))
dest_host_inventory_vars.get('ansible_host'),
dest_host_inventory_vars.get('ansible_ssh_host'))
if hostid is not None]
localhost_ports = set()