mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
This commit is contained in:
parent
7d8a4b13a5
commit
ba420c47cd
4 changed files with 5 additions and 4 deletions
|
@ -467,7 +467,7 @@ def main():
|
||||||
if is_rsh_needed(source, dest):
|
if is_rsh_needed(source, dest):
|
||||||
ssh_cmd = [module.get_bin_path('ssh', required=True), '-S', 'none']
|
ssh_cmd = [module.get_bin_path('ssh', required=True), '-S', 'none']
|
||||||
if private_key is not None:
|
if private_key is not None:
|
||||||
ssh_cmd.extend(['-i', private_key])
|
ssh_cmd.extend(['-i', os.path.expanduser(private_key) ])
|
||||||
# If the user specified a port value
|
# If the user specified a port value
|
||||||
# Note: The action plugin takes care of setting this to a port from
|
# Note: The action plugin takes care of setting this to a port from
|
||||||
# inventory if the user didn't specify an explicit dest_port
|
# inventory if the user didn't specify an explicit dest_port
|
||||||
|
|
|
@ -316,6 +316,8 @@ class ActionModule(ActionBase):
|
||||||
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
|
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
|
||||||
if use_delegate:
|
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_ssh_user', None)
|
||||||
|
if not user:
|
||||||
|
user = task_vars.get('ansible_ssh_user') or self._play_context.remote_user
|
||||||
if not user:
|
if not user:
|
||||||
user = C.DEFAULT_REMOTE_USER
|
user = C.DEFAULT_REMOTE_USER
|
||||||
|
|
||||||
|
@ -326,7 +328,6 @@ class ActionModule(ActionBase):
|
||||||
private_key = self._play_context.private_key_file
|
private_key = self._play_context.private_key_file
|
||||||
|
|
||||||
if private_key is not None:
|
if private_key is not None:
|
||||||
private_key = os.path.expanduser(private_key)
|
|
||||||
_tmp_args['private_key'] = private_key
|
_tmp_args['private_key'] = private_key
|
||||||
|
|
||||||
# use the mode to define src and dest's url
|
# use the mode to define src and dest's url
|
||||||
|
|
|
@ -23,4 +23,4 @@ asserts:
|
||||||
- "self.execute_called"
|
- "self.execute_called"
|
||||||
- "self.final_module_args['_local_rsync_path'] == 'rsync'"
|
- "self.final_module_args['_local_rsync_path'] == 'rsync'"
|
||||||
- "self.final_module_args['src'] == '/tmp/deleteme'"
|
- "self.final_module_args['src'] == '/tmp/deleteme'"
|
||||||
- "self.final_module_args['dest'] == 'el6host:/tmp/deleteme'"
|
- "self.final_module_args['dest'] == 'root@el6host:/tmp/deleteme'"
|
||||||
|
|
|
@ -30,4 +30,4 @@ asserts:
|
||||||
- "self.execute_called"
|
- "self.execute_called"
|
||||||
- "self.final_module_args['_local_rsync_path'] == 'rsync'"
|
- "self.final_module_args['_local_rsync_path'] == 'rsync'"
|
||||||
- "self.final_module_args['src'] == '/tmp/deleteme'"
|
- "self.final_module_args['src'] == '/tmp/deleteme'"
|
||||||
- "self.final_module_args['dest'] == 'el6host:/tmp/deleteme'"
|
- "self.final_module_args['dest'] == 'root@el6host:/tmp/deleteme'"
|
||||||
|
|
Loading…
Reference in a new issue