#!/usr/bin/env bash
set -o pipefail
set -o errtrace
set -o nounset
set -o errexit
ANSIBLE_ROLES_PATH=${ANSIBLE_ROLES_PATH:-/drone/src}
if [ "$GCE_SSH_KEY" ]; then
echo "$GCE_SSH_KEY" > $HOME/.ssh/google_compute_engine
chmod 600 $HOME/.ssh/google_compute_engine
fi
if [ "$GCE_CREDENTIALS_JSON" ] && [ "$GCE_CREDENTIALS_FILE" ]; then
DIR=$(dirname "$GCE_CREDENTIALS_FILE")
mkdir -p "${DIR}"
echo "$GCE_CREDENTIALS_JSON" > "$GCE_CREDENTIALS_FILE"
if [ "${MOLECULE_CUSTOM_MODULES_REPO}" ]; then
mkdir ./library/
git clone "$MOLECULE_CUSTOM_MODULES_REPO" ./library/
if [ "${MOLECULE_CUSTOM_FILTERS_REPO}" ]; then
mkdir -p ./plugins/filters/
git clone "$MOLECULE_CUSTOM_FILTERS_REPO" ./plugins/filters/