Use env vars correctly
This commit is contained in:
parent
9ae81edebc
commit
90d4afe838
15
functions
15
functions
@ -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"
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user