1
0
Fork 0
mirror of https://github.com/ansible-collections/ansible.posix.git synced 2026-02-04 08:01:49 +00:00

replace no more supported 'ansible_ssh_*' option names by the new ones

* Replace 'ansible_ssh_user' by 'ansible_user' everywhere.
* Replace 'ansible_ssh_port' by 'ansible_port' everywhere.
* Replace 'ansible_ssh_host' by 'ansible_host' everywhere.
This commit is contained in:
quidame 2021-03-28 04:21:12 +02:00
parent ecd5ad53e0
commit d976add5da
25 changed files with 212 additions and 213 deletions

View file

@ -219,14 +219,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)
try:
dest_host = dest_host_inventory_vars['ansible_host']
except KeyError:
dest_host = dest_host_inventory_vars.get('ansible_ssh_host', inventory_hostname)
dest_host = dest_host_inventory_vars.get('ansible_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_ssh_host'))
dest_host_inventory_vars.get('ansible_host'))
if hostid is not None]
localhost_ports = set()
@ -250,7 +246,7 @@ class ActionModule(ActionBase):
dest_is_local = True
# CHECK FOR NON-DEFAULT SSH PORT
inv_port = task_vars.get('ansible_ssh_port', None) or C.DEFAULT_REMOTE_PORT
inv_port = task_vars.get('ansible_port', None) or C.DEFAULT_REMOTE_PORT
if _tmp_args.get('dest_port', None) is None:
if inv_port is not None:
_tmp_args['dest_port'] = inv_port
@ -327,14 +323,14 @@ class ActionModule(ActionBase):
# Src and dest rsync "path" handling
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
if use_delegate:
user = task_vars.get('ansible_delegated_vars', dict()).get('ansible_ssh_user', None)
user = task_vars.get('ansible_delegated_vars', dict()).get('ansible_user', None)
if not user:
user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
user = task_vars.get('ansible_user') or self._play_context.remote_user
if not user:
user = C.DEFAULT_REMOTE_USER
else:
user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
user = task_vars.get('ansible_user') or self._play_context.remote_user
# Private key handling
# Use the private_key parameter if passed else use context private_key_file

View file

@ -38,9 +38,8 @@ options:
description:
- Port number for ssh on the destination host.
- Prior to Ansible 2.0, the ansible_ssh_port inventory var took precedence over this value.
- This parameter defaults to the value of C(ansible_ssh_port) or C(ansible_port),
the C(remote_port) config setting or the value from ssh client configuration
if none of the former have been set.
- This parameter defaults to the value of C(ansible_port), the C(remote_port) config setting
or the value from ssh client configuration if none of the former have been set.
type: int
mode:
description: