add option to pass Ansible vault password
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Robert Kaussow 2020-10-08 11:13:26 +02:00
parent 0bd446408b
commit d9ce8cf1df
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
3 changed files with 13 additions and 3 deletions

View File

@ -1,2 +1,5 @@
- INTERNAL
- migrate to `thegeeklab` namespace
- ENHANCEMENT
- Add env variable `MOLECULE_ANSIBLE_VAULT_PASSWORD`.
If the variable is set, the value is written to
`ANSIBLE_VAULT_PASSWORD_FILE=/root/.vaultpasswd and
passed to molecule.

View File

@ -26,6 +26,10 @@ MOLECULE_PLUGINS_DIR=$(pwd)/plugins
# If you have custom filters you can specify a git repo containing these files.
# Will be cloned to $MOLECULE_PLUGINS_DIR/filter
MOLECULE_CUSTOM_FILTERS_REPO=
# If the variable is set, the value is written to `ANSIBLE_VAULT_PASSWORD_FILE=/root/.vaultpasswd
and automatically passed to molecule.
MOLECULE_ANSIBLE_VAULT_PASSWORD=my_secret
```
## License

View File

@ -21,4 +21,7 @@ if [ -n "${MOLECULE_CUSTOM_FILTERS_REPO}" ]; then
git clone "$MOLECULE_CUSTOM_FILTERS_REPO" "$WORKDIR" 2> /dev/null
fi
exec /usr/local/bin/molecule "$@"
touch /root/.vaultpasswd
echo "${MOLECULE_ANSIBLE_VAULT_PASSWORD}" > /root/.vaultpasswd
exec env ANSIBLE_VAULT_PASSWORD_FILE=/root/.vaultpasswd /usr/local/bin/molecule "$@"