diff --git a/plugins/action/synchronize.py b/plugins/action/synchronize.py index b6edd9f..10d8bdf 100644 --- a/plugins/action/synchronize.py +++ b/plugins/action/synchronize.py @@ -371,7 +371,10 @@ class ActionModule(ActionBase): # 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': - rsync_path = 'sudo rsync' + 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