From fa5693cfc78eec7abc621f7c4e2fc8f6214e50fe Mon Sep 17 00:00:00 2001 From: Ronny Buchmann Date: Thu, 26 Feb 2026 14:59:28 +0100 Subject: [PATCH 1/2] Use password from command line through play context Added fallback for password retrieval in synchronize.py --- plugins/action/synchronize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/action/synchronize.py b/plugins/action/synchronize.py index a171a2b..72dc5be 100644 --- a/plugins/action/synchronize.py +++ b/plugins/action/synchronize.py @@ -342,7 +342,7 @@ class ActionModule(ActionBase): # Determine if we need a user@ and a password user = None - password = task_vars.get('ansible_ssh_pass', None) or task_vars.get('ansible_password', None) + password = task_vars.get('ansible_ssh_pass', None) or task_vars.get('ansible_password', None) or self._play_context.password if not dest_is_local: # Src and dest rsync "path" handling if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False): @@ -372,7 +372,7 @@ class ActionModule(ActionBase): src = self._process_origin(src_host, src, user) 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) + password = dest_host_inventory_vars.get('ansible_ssh_pass', None) or dest_host_inventory_vars.get('ansible_password', None) or self._play_context.password if self._templar is not None: password = self._templar.template(password) else: From 3cda1418ddff8a2945e4e00f1b1ad674b2d61eab Mon Sep 17 00:00:00 2001 From: Ronny Buchmann Date: Thu, 26 Feb 2026 23:00:09 +0100 Subject: [PATCH 2/2] break overly long statements into multiple lines --- plugins/action/synchronize.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/action/synchronize.py b/plugins/action/synchronize.py index 72dc5be..3d53cd2 100644 --- a/plugins/action/synchronize.py +++ b/plugins/action/synchronize.py @@ -342,7 +342,9 @@ class ActionModule(ActionBase): # Determine if we need a user@ and a password user = None - password = task_vars.get('ansible_ssh_pass', None) or task_vars.get('ansible_password', None) or self._play_context.password + password = (task_vars.get('ansible_ssh_pass', None) + or task_vars.get('ansible_password', None) + or self._play_context.password) if not dest_is_local: # Src and dest rsync "path" handling if boolean(_tmp_args.get('set_remote_user', 'yes'), strict=False): @@ -372,7 +374,9 @@ class ActionModule(ActionBase): src = self._process_origin(src_host, src, user) 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) or self._play_context.password + password = (dest_host_inventory_vars.get('ansible_ssh_pass', None) + or dest_host_inventory_vars.get('ansible_password', None) + or self._play_context.password) if self._templar is not None: password = self._templar.template(password) else: