Use env vars correctly

This commit is contained in:
Luke Murphy 2020-03-19 02:19:57 +01:00
parent 9ae81edebc
commit 90d4afe838
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
3 changed files with 15 additions and 12 deletions

View File

@ -2,21 +2,20 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
REQUIREMENTS=".ansible/requirements.yml"
function run_playbook() {
local play_path="$1"
local requirements="$2"
if [[ ! -f "$play_path" ]]; then
echo " $play_path not found or executable bit not set. Skipping ..."
echo " $play_path not found or executable bit not set"
exit 0
fi
if [[ -f "$REQUIREMENTS" ]]; then
echo " $REQUIREMENTS file found. Running it ..."
ansible-galaxy install -fvf "$REQUIREMENTS"
if [[ -f "$requirements" ]]; then
echo " $requirements file found"
ansible-galaxy install -fvf "$requirements"
fi
echo " $play_path file found. Running it ..."
ansible-playbook -i 127.0.0.1, --connection local -v "$play_path"
echo " $play_path file found"
ansible-playbook -i 127.0.0.1, -c local -v "$play_path"
}

View File

@ -2,8 +2,10 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
PLAYBBOOK=".ansible/post-deploy.yml"
APP="$1"
PLAYBOOK="$DOKKU_ROOT/$APP/ansible/post-deploy.yml"
REQUIREMENTS="$DOKKU_ROOT/$APP/ansible/requirements.yml"
echo "-----> Running post-deploy ansible playbook"
. $(dirname "$0")/functions
run_playbook "$PLAYBOOK"
run_playbook "$PLAYBOOK" "$REQUIREMENTS"

View File

@ -2,8 +2,10 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
PLAYBBOOK=".ansible/pre-deploy.yml"
APP="$1"
PLAYBOOK="$DOKKU_ROOT/$APP/ansible/post-deploy.yml"
REQUIREMENTS="$DOKKU_ROOT/$APP/ansible/requirements.yml"
echo "-----> Running pre-deploy ansible playbook"
. $(dirname "$0")/functions
run_playbook "$PLAYBOOK"
run_playbook "$PLAYBOOK" "$REQUIREMENTS"