This repository has been archived on 2020-05-08. You can view files and clone it, but cannot push or open issues or pull requests.
dokku-ansible-playbook/functions

24 lines
586 B
Plaintext
Raw Normal View History

2020-03-19 00:43:41 +00:00
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
2020-03-19 22:45:06 +00:00
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
2020-03-19 00:43:41 +00:00
function run_playbook() {
local play_path="$1"
2020-03-19 01:19:57 +00:00
local requirements="$2"
2020-03-19 00:43:41 +00:00
2020-03-19 01:05:30 +00:00
if [[ ! -f "$play_path" ]]; then
2020-03-19 22:42:53 +00:00
dokku_col_log_info1_quiet "$play_path not found or executable bit not set"
2020-03-19 00:43:41 +00:00
exit 0
fi
2020-03-19 01:19:57 +00:00
if [[ -f "$requirements" ]]; then
2020-03-19 22:42:53 +00:00
dokku_col_log_info1_quiet "$requirements file found"
2020-03-19 01:25:40 +00:00
ansible-galaxy install -fr "$requirements"
2020-03-19 00:43:41 +00:00
fi
2020-03-19 22:42:53 +00:00
dokku_col_log_info1_quiet "$play_path file found"
2020-03-19 22:29:59 +00:00
ansible-playbook -i 127.0.0.1, -c local "$play_path"
2020-03-19 00:43:41 +00:00
}