diff --git a/functions b/functions index 4fd85f4..2e8b80d 100755 --- a/functions +++ b/functions @@ -5,8 +5,9 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" function run_playbook() { - local play_path="$1" - local requirements="$2" + 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" @@ -15,9 +16,15 @@ function run_playbook() { if [[ -f "$requirements" ]]; then dokku_col_log_info1_quiet "$requirements file found" - ansible-galaxy install -vvv --force --role-file "$requirements" + ansible-galaxy install \ + -vvv --force \ + --roles-path "$DOKKU_LIB_ROOT/data/ansible/$APP" \ + --role-file "$requirements" fi dokku_col_log_info1_quiet "$play_path file found" - ansible-playbook --inventory "$(hostname)", --connection local "$play_path" + ANSIBLE_ROLES_PATH="$DOKKU_LIB_ROOT/data/ansible/$APP" ansible-playbook \ + --inventory "$(hostname)", \ + --connection local \ + "$play_path" } diff --git a/post-deploy b/post-deploy index 36e6cef..5df26da 100755 --- a/post-deploy +++ b/post-deploy @@ -13,7 +13,7 @@ dokku-ansible-playbook-post-deploy() { dokku_col_log_info1_quiet "Running post-deploy ansible playbook" - run_playbook "$PLAYBOOK" "$REQUIREMENTS" + run_playbook "$APP" "$PLAYBOOK" "$REQUIREMENTS" } dokku-ansible-playbook-post-deploy "$@" diff --git a/pre-deploy b/pre-deploy index c58bd5c..ff022cc 100755 --- a/pre-deploy +++ b/pre-deploy @@ -13,7 +13,7 @@ dokku-ansible-playbook-pre-deploy() { dokku_col_log_info1_quiet "Running pre-deploy ansible playbook" - run_playbook "$PLAYBOOK" "$REQUIREMENTS" + run_playbook "$APP" "$PLAYBOOK" "$REQUIREMENTS" } dokku-ansible-playbook-pre-deploy "$@"