add option to pass Ansible vault password
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Robert Kaussow 2020-10-08 11:13:26 +02:00
parent 0bd446408b
commit d9ce8cf1df
Signed by: xoxys
GPG Key ID: 65362AE74AF98B61
3 changed files with 13 additions and 3 deletions

View File

@ -1,2 +1,5 @@
- INTERNAL - ENHANCEMENT
- migrate to `thegeeklab` namespace - 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. # If you have custom filters you can specify a git repo containing these files.
# Will be cloned to $MOLECULE_PLUGINS_DIR/filter # Will be cloned to $MOLECULE_PLUGINS_DIR/filter
MOLECULE_CUSTOM_FILTERS_REPO= 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 ## License

View File

@ -21,4 +21,7 @@ if [ -n "${MOLECULE_CUSTOM_FILTERS_REPO}" ]; then
git clone "$MOLECULE_CUSTOM_FILTERS_REPO" "$WORKDIR" 2> /dev/null git clone "$MOLECULE_CUSTOM_FILTERS_REPO" "$WORKDIR" 2> /dev/null
fi 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 "$@"