37 lines
841 B
Bash
Executable File
37 lines
841 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|
|
|
function run_playbook() {
|
|
local app="$1"
|
|
local play_path="$2"
|
|
local requirements="$3"
|
|
|
|
if [[ ! -f "$play_path" ]]; then
|
|
dokku_col_log_info1_quiet "$play_path not found or executable bit not set"
|
|
exit 0
|
|
fi
|
|
|
|
pushd "$DOKKU_LIB_ROOT/data/ansible/$APP/" >/dev/null
|
|
|
|
if [[ -f "$requirements" ]]; then
|
|
dokku_col_log_info1_quiet "$requirements file found"
|
|
ansible-galaxy \
|
|
install \
|
|
--force \
|
|
--roles-path "$(pwd)/roles" \
|
|
--role-file "$requirements"
|
|
fi
|
|
|
|
dokku_col_log_info1_quiet "$play_path file found"
|
|
ansible-playbook \
|
|
--inventory "$(hostname)", \
|
|
--connection local \
|
|
"$play_path"
|
|
--module-path "$(pwd)/roles/*/library" \
|
|
|
|
popd >/dev/null
|
|
}
|