mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 23:25:28 +01:00
Fixes ##390. Hosts involved must have same password
This commit is contained in:
parent
83a933772c
commit
139e103b0f
1 changed files with 7 additions and 3 deletions
|
|
@ -225,7 +225,6 @@ class ActionModule(ActionBase):
|
||||||
|
|
||||||
# Parameter name needed by the ansible module
|
# Parameter name needed by the ansible module
|
||||||
_tmp_args['_local_rsync_path'] = task_vars.get('ansible_rsync_path') or 'rsync'
|
_tmp_args['_local_rsync_path'] = task_vars.get('ansible_rsync_path') or 'rsync'
|
||||||
_tmp_args['_local_rsync_password'] = task_vars.get('ansible_ssh_pass') or task_vars.get('ansible_password')
|
|
||||||
|
|
||||||
# rsync thinks that one end of the connection is localhost and the
|
# rsync thinks that one end of the connection is localhost and the
|
||||||
# other is the host we're running the task for (Note: We use
|
# other is the host we're running the task for (Note: We use
|
||||||
|
|
@ -333,8 +332,9 @@ class ActionModule(ActionBase):
|
||||||
if src is None or dest is None:
|
if src is None or dest is None:
|
||||||
return dict(failed=True, msg="synchronize requires both src and dest parameters are set")
|
return dict(failed=True, msg="synchronize requires both src and dest parameters are set")
|
||||||
|
|
||||||
# Determine if we need a user@
|
# Determine if we need a user@ and a password
|
||||||
user = None
|
user = None
|
||||||
|
password = task_vars.get('ansible_ssh_pass', None) or task_vars.get('ansible_password', None)
|
||||||
if not dest_is_local:
|
if not dest_is_local:
|
||||||
# Src and dest rsync "path" handling
|
# Src and dest rsync "path" handling
|
||||||
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
|
if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False):
|
||||||
|
|
@ -344,10 +344,11 @@ class ActionModule(ActionBase):
|
||||||
user = task_vars.get('ansible_user') or self._play_context.remote_user
|
user = task_vars.get('ansible_user') or self._play_context.remote_user
|
||||||
if not user:
|
if not user:
|
||||||
user = C.DEFAULT_REMOTE_USER
|
user = C.DEFAULT_REMOTE_USER
|
||||||
|
|
||||||
else:
|
else:
|
||||||
user = task_vars.get('ansible_user') or self._play_context.remote_user
|
user = task_vars.get('ansible_user') or self._play_context.remote_user
|
||||||
|
|
||||||
|
user = self._templar.template(user)
|
||||||
|
|
||||||
# Private key handling
|
# Private key handling
|
||||||
# Use the private_key parameter if passed else use context private_key_file
|
# Use the private_key parameter if passed else use context private_key_file
|
||||||
_tmp_args['private_key'] = _tmp_args.get('private_key', self._play_context.private_key_file)
|
_tmp_args['private_key'] = _tmp_args.get('private_key', self._play_context.private_key_file)
|
||||||
|
|
@ -361,12 +362,15 @@ class ActionModule(ActionBase):
|
||||||
# src is a local path, dest is a remote path: <user>@<host>
|
# src is a local path, dest is a remote path: <user>@<host>
|
||||||
src = self._process_origin(src_host, src, user)
|
src = self._process_origin(src_host, src, user)
|
||||||
dest = self._process_remote(_tmp_args, dest_host, dest, user, inv_port in localhost_ports)
|
dest = self._process_remote(_tmp_args, dest_host, dest, user, inv_port in localhost_ports)
|
||||||
|
|
||||||
|
password = dest_host_inventory_vars.get('ansible_ssh_pass', None) or dest_host_inventory_vars.get('ansible_password', None)
|
||||||
else:
|
else:
|
||||||
# Still need to munge paths (to account for roles) even if we aren't
|
# Still need to munge paths (to account for roles) even if we aren't
|
||||||
# copying files between hosts
|
# copying files between hosts
|
||||||
src = self._get_absolute_path(path=src)
|
src = self._get_absolute_path(path=src)
|
||||||
dest = self._get_absolute_path(path=dest)
|
dest = self._get_absolute_path(path=dest)
|
||||||
|
|
||||||
|
_tmp_args['_local_rsync_password'] = self._templar.template(password)
|
||||||
_tmp_args['src'] = src
|
_tmp_args['src'] = src
|
||||||
_tmp_args['dest'] = dest
|
_tmp_args['dest'] = dest
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue