This repository has been archived on 2024-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
molecule/overlay/bin/molecule

30 lines
998 B
Plaintext
Raw Normal View History

2020-02-20 16:24:52 +00:00
#!/usr/bin/env sh
2020-10-08 10:19:33 +00:00
# shellcheck disable=2039
set -eo pipefail
2019-11-22 22:31:53 +00:00
DIR=$(pwd)
2020-02-20 22:24:46 +00:00
[ -z "${MOLECULE_LIBRARY_DIR}" ] && MOLECULE_LIBRARY_DIR=${DIR%/}/library
[ -z "${MOLECULE_PLUGINS_DIR}" ] && MOLECULE_PLUGINS_DIR=${DIR%/}/plugins
2020-02-20 22:24:46 +00:00
if [ -n "${MOLECULE_CUSTOM_MODULES_REPO}" ]; then
printf "Cloning custom modules ...\n"
WORKDIR="${MOLECULE_LIBRARY_DIR}"
[ -d "$WORKDIR" ] && rm -rf "$WORKDIR"
mkdir -p "$WORKDIR"
git clone "$MOLECULE_CUSTOM_MODULES_REPO" "$WORKDIR" 2> /dev/null
fi
2020-02-20 22:24:46 +00:00
if [ -n "${MOLECULE_CUSTOM_FILTERS_REPO}" ]; then
WORKDIR="${MOLECULE_PLUGINS_DIR}/filter"
printf "Cloning custom filters ...\n"
[ -d "$WORKDIR" ] && rm -rf "$WORKDIR"
mkdir -p "$WORKDIR"
git clone "$MOLECULE_CUSTOM_FILTERS_REPO" "$WORKDIR" 2> /dev/null
fi
2020-10-10 08:22:46 +00:00
if [ -n "${MOLECULE_ANSIBLE_VAULT_PASSWORD}" ]; then
echo "${MOLECULE_ANSIBLE_VAULT_PASSWORD}" > /root/.vaultpasswd
fi
2020-10-10 08:22:46 +00:00
exec env ANSIBLE_VAULT_PASSWORD_FILE="${MOLECULE_ANSIBLE_VAULT_PASSWORD}" /usr/local/bin/molecule "$@"