You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the synchronize module in an until: loop, the first attempt will have --rsync-path set correctly to add sudo, but subsequent retries will not have sudo, it omits the --rsync-path argument entirely.
I believe this is due to the code in the synchronize.py action module which reads play_context.become and sets the rsync_path appropriately, but then sets play_context.become to False. I think Ansible is not re-setting the play_context on retries, so it continues to be False.
if not dest_is_local:
# don't escalate for docker. doing --rsync-path with docker exec fails
# and we can switch directly to the user via docker arguments
if self._play_context.become and not rsync_path and self._remote_transport not in DOCKER + PODMAN:
# If no rsync_path is set, become was originally set, and dest is
# remote then add privilege escalation here.
if self._play_context.become_method == 'sudo':
if self._play_context.become_user:
rsync_path = 'sudo -u %s rsync' % self._play_context.become_user
else:
rsync_path = 'sudo rsync'
# TODO: have to add in the rest of the become methods here
# We cannot use privilege escalation on the machine running the
# module. Instead we run it on the machine rsync is connecting
# to.
self._play_context.become = False
The workaround is to explicitly specify "rsync_path: sudo rsync" in the task, instead of letting the synchronize module default it.
ISSUE TYPE
Bug Report
COMPONENT NAME
synchronize.py
ANSIBLE VERSION
ansible [core 2.15.0]
COLLECTION VERSION
1.5.4
CONFIGURATION
N/A
OS / ENVIRONMENT
RHEL8
STEPS TO REPRODUCE
Use the synchronize module, do not specify the rsync_path, and specify until: with at least 1 retry.Make the synchronize fail the first time, and enter the retry. View the -vvvvv output to see that the first attempt has rsync_path defined with sudo, but the second attempt does not.
EXPECTED RESULTS
synchronize sets rsync_path on retries to sudo
ACTUAL RESULTS
synchronize does not set rsync_path on retries to sudo
The text was updated successfully, but these errors were encountered:
SUMMARY
When using the synchronize module in an until: loop, the first attempt will have --rsync-path set correctly to add sudo, but subsequent retries will not have sudo, it omits the --rsync-path argument entirely.
I believe this is due to the code in the synchronize.py action module which reads play_context.become and sets the rsync_path appropriately, but then sets play_context.become to False. I think Ansible is not re-setting the play_context on retries, so it continues to be False.
The workaround is to explicitly specify "rsync_path: sudo rsync" in the task, instead of letting the synchronize module default it.
ISSUE TYPE
COMPONENT NAME
synchronize.py
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
RHEL8
STEPS TO REPRODUCE
EXPECTED RESULTS
synchronize sets rsync_path on retries to sudo
ACTUAL RESULTS
synchronize does not set rsync_path on retries to sudo
The text was updated successfully, but these errors were encountered: