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
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
REQUIREMENTS=".ansible/requirements.yml"
|
|
||||||
|
|
||||||
function run_playbook() {
|
function run_playbook() {
|
||||||
local play_path="$1"
|
local play_path="$1"
|
||||||
|
local requirements="$2"
|
||||||
|
|
||||||
if [[ ! -f "$play_path" ]]; then
|
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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$REQUIREMENTS" ]]; then
|
if [[ -f "$requirements" ]]; then
|
||||||
echo " $REQUIREMENTS file found. Running it ..."
|
echo " $requirements file found"
|
||||||
ansible-galaxy install -fvf "$REQUIREMENTS"
|
ansible-galaxy install -fvf "$requirements"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " $play_path file found. Running it ..."
|
echo " $play_path file found"
|
||||||
ansible-playbook -i 127.0.0.1, --connection local -v "$play_path"
|
ansible-playbook -i 127.0.0.1, -c local -v "$play_path"
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
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"
|
echo "-----> Running post-deploy ansible playbook"
|
||||||
. $(dirname "$0")/functions
|
. $(dirname "$0")/functions
|
||||||
run_playbook "$PLAYBOOK"
|
run_playbook "$PLAYBOOK" "$REQUIREMENTS"
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
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"
|
echo "-----> Running pre-deploy ansible playbook"
|
||||||
. $(dirname "$0")/functions
|
. $(dirname "$0")/functions
|
||||||
run_playbook "$PLAYBOOK"
|
run_playbook "$PLAYBOOK" "$REQUIREMENTS"
|
||||||
|
Reference in New Issue
Block a user