Actually, we don't need python at all

This commit is contained in:
Luke Murphy
2020-04-13 11:42:33 +02:00
parent b3e2d08100
commit ded81dab45
12 changed files with 137 additions and 79 deletions

View File

@ -111,16 +111,28 @@ dokku-ansible-deploy-pre-deploy() {
dokku-ansible-deploy-validate-dependencies
declare APP="$1"
declare APP_CONFIG_PATH="$DOKKU_LIB_ROOT/data/deploy.d/$APP"
declare PLUGIN_PATH="$PLUGIN_CORE_AVAILABLE_PATH/ansible-deploy"
declare PREDEPLOY="$PLUGIN_CORE_AVAILABLE_PATH/ansible-deploy/scripts/predeploy.py"
declare APP_DIR="$DOKKU_LIB_ROOT/data/deploy.d/$APP"
declare VAULT_FILE="$APP_DIR/.vault-password.sh"
declare PRE_DEPLOY="$PLUGIN_CORE_AVAILABLE_PATH/ansible-deploy/plays/pre_deploy.yml"
dokku_col_log_info1_quiet "Running pre-deploy steps"
/usr/bin/python3 "$PREDEPLOY"
--app "$APP" \
--app-config-path "$APP_CONFIG_PATH" \
--plugin-path "$PLUGIN_PATH"
# shellcheck disable=SC2155
local CMD_ARGS="--inventory $(hostname), --connection local"
if [[ -f $VAULT_FILE ]]; then
dokku_col_log_info1_quiet "$APP vault password file $VAULT_FILE discovered"
CMD_ARGS="${CMD_ARGS} --vault-password-file $VAULT_FILE"
fi
dokku_col_log_info1_quiet "Running $PRE_DEPLOY"
ansible-playbook \
--extra-vars "app=$APP" \
--extra-vars "dokku_lib_root=$DOKKU_LIB_ROOT" \
--extra-vars "app_config_root=$APP_DIR" \
"$CMD_ARGS" \
"$PRE_DEPLOY"
}
dokku-ansible-deploy-post-deploy() {
@ -130,10 +142,27 @@ dokku-ansible-deploy-post-deploy() {
dokku-ansible-deploy-validate-dependencies
declare APP="$1"
declare POSTDEPLOY="$PLUGIN_CORE_AVAILABLE_PATH/ansible-deploy/scripts/postdeploy.py"
declare APP_DIR="$DOKKU_LIB_ROOT/data/deploy.d/$APP"
declare VAULT_FILE="$APP_DIR/.vault-password.sh"
declare POST_DEPLOY="$PLUGIN_CORE_AVAILABLE_PATH/ansible-deploy/plays/post_deploy.yml"
dokku_col_log_info1_quiet "Running post-deploy steps"
/usr/bin/python3 "$POSTDEPLOY" "$APP"
# shellcheck disable=SC2155
local CMD_ARGS="--inventory $(hostname), --connection local"
if [[ -f $VAULT_FILE ]]; then
dokku_col_log_info1_quiet "$APP vault password file $VAULT_FILE discovered"
CMD_ARGS="${CMD_ARGS} --vault-password-file $VAULT_FILE"
fi
dokku_col_log_info1_quiet "Running $POST_DEPLOY"
ansible-playbook \
--extra-vars "app=$APP" \
--extra-vars "dokku_lib_root=$DOKKU_LIB_ROOT" \
--extra-vars "app_config_root=$APP_DIR" \ "$CMD_ARGS" \
"$POST_DEPLOY"
}
dokku-ansible-deploy-post-delete() {
@ -143,8 +172,26 @@ dokku-ansible-deploy-post-delete() {
dokku-ansible-deploy-validate-dependencies
declare APP="$1"
declare POSTDELETE="$PLUGIN_CORE_AVAILABLE_PATH/ansible-deploy/scripts/postdelete.py"
declare APP_DIR="$DOKKU_LIB_ROOT/data/deploy.d/$APP"
declare VAULT_FILE="$APP_DIR/.vault-password.sh"
declare POST_DELETE="$PLUGIN_CORE_AVAILABLE_PATH/ansible-deploy/plays/post_delete.yml"
dokku_col_log_info1_quiet "Running post-delete steps"
/usr/bin/python3 "$POSTDELETE"
# shellcheck disable=SC2155
local CMD_ARGS="--inventory $(hostname), --connection local"
if [[ -f $VAULT_FILE ]]; then
dokku_col_log_info1_quiet "$APP vault password file $VAULT_FILE discovered"
CMD_ARGS="${CMD_ARGS} --vault-password-file $VAULT_FILE"
fi
dokku_col_log_info1_quiet "Running $POST_DELETE"
ansible-playbook \
--extra-vars "app=$APP" \
--extra-vars "dokku_lib_root=$DOKKU_LIB_ROOT" \
--extra-vars "app_config_root=$APP_DIR" \
"$CMD_ARGS" \
"$POST_DELETE"
}