I forgot the solution. Here it is:
- name: Restore repositories
synchronize: src="{{ item }}" dest="/home/git"
with_lines: find /home/git/ -maxdepth 1 -name "*.git" -type d
become: no
tags: restore
This will attempt a synchronize by executing the rsync as the user who
executes the playbook. This works in my case.
If you want to change the identity of the user executing locally the rsync,
you have to set become: yes, become_user: X where X is the new local user
identity.
If switching the local user identity to X with su or sudo requires a
password, you are doomed. Note that running the command as root which in
principle should allow changing the local user identity without password
didn't work. So I'm not fully sure if my current understanding is correct.
The command line parameter --ask-become-pass applies to the change of the
remote user identity. There is currently no support for changing the local
user identity.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/59922dfa-5477-4ed0-b072-218be23c9d52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.