When simply using the command line, the main strategy would be to use the cache
git credential helper:
git config --global credential.helper cache
git config --global credential.username {{ gituser }}
git pull {{ repository1 }}
... asks password
... pulls
git pull {{ repository2 }}
... pulls
... etc.
But if I use the ansible git module, prompting does not work (nor is it practical). The only solution I currently see is to use:
- git: repo=https://{{ gituser }}:{{ gitpass }}@{{ repo_url }} dest={{ dest }}
Where I get gituser
and gitpass
using vars_prompt:
, or from ansible's local secure storage. However, this has the unfornutate side effect that it stores the password in {{ dest }}/.git/config
in plain text, which I would like to avoid.
Is there a way to set the password from ansible for the time of the playbook run, but not to store it on the server?