Use env vars once more
This commit is contained in:
parent
c054726deb
commit
75fda62af1
12
functions
12
functions
@ -4,24 +4,26 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
|
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
|
|
||||||
function run_playbook() {
|
function run_playbook() {
|
||||||
local app="$1"
|
local app="$1"
|
||||||
local play_path="$2"
|
local play_path="$2"
|
||||||
local requirements="$3"
|
local requirements="$3"
|
||||||
|
|
||||||
|
export ANSIBLE_ROLES_PATH="$DOKKU_LIB_ROOT/data/ansible/$APP/roles"
|
||||||
|
export ANSIBLE_LIBRARY="$DOKKU_LIB_ROOT/data/ansible/$APP/roles/*/library"
|
||||||
|
|
||||||
if [[ ! -f "$play_path" ]]; then
|
if [[ ! -f "$play_path" ]]; then
|
||||||
dokku_col_log_info1_quiet "$play_path not found or executable bit not set"
|
dokku_col_log_info1_quiet "$play_path not found or executable bit not set"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$DOKKU_LIB_ROOT/data/ansible/$APP"
|
|
||||||
|
|
||||||
if [[ -f "$requirements" ]]; then
|
if [[ -f "$requirements" ]]; then
|
||||||
dokku_col_log_info1_quiet "$requirements file found"
|
dokku_col_log_info1_quiet "$requirements file found"
|
||||||
ansible-galaxy \
|
ansible-galaxy \
|
||||||
install \
|
install \
|
||||||
--force \
|
--force \
|
||||||
--roles-path "$(pwd)/roles" \
|
--roles-path "$DOKKU_LIB_ROOT/data/ansible/$APP/roles" \
|
||||||
--role-file "$requirements"
|
--role-file "$requirements"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -29,6 +31,6 @@ function run_playbook() {
|
|||||||
ansible-playbook \
|
ansible-playbook \
|
||||||
--inventory "$(hostname)", \
|
--inventory "$(hostname)", \
|
||||||
--connection local \
|
--connection local \
|
||||||
"$play_path" \
|
--module-path "$ANSIBLE_LIBRARY" \
|
||||||
--module-path "$(pwd)/roles/*/library"
|
"$play_path"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user