From 9049479dda62e845e87c6cb22050f82272cc542b Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Sat, 26 Aug 2017 11:55:48 +0100 Subject: [PATCH] Add pre- and post- stage hooks to leap redeploy process It may be desired to execute additional playbooks during the redeploy process. This adds pre- and post- stage hooks before/after the execution of the setup-hosts, setup-infrastructure and setup-openstack stages. They will only be utilised if the env vars are set to something. If they are not then the leap process will continue as-is. Change-Id: I60977648db784f038c67fe71ee6d2a01f4df7db2 --- leap-upgrades/re-deploy.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/leap-upgrades/re-deploy.sh b/leap-upgrades/re-deploy.sh index 742ea8e7..97971485 100755 --- a/leap-upgrades/re-deploy.sh +++ b/leap-upgrades/re-deploy.sh @@ -40,6 +40,13 @@ fi link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}" RUN_TASKS=() + +# Pre-setup-hosts hook +if [ -n "$PRE_SETUP_HOSTS_HOOK" ]; then + RUN_TASKS+=("$PRE_SETUP_HOSTS_HOOK") +fi + +# Setup Hosts RUN_TASKS+=("openstack-hosts-setup.yml -e redeploy_rerun=true") # Ensure the same pip everywhere, even if requirement met or above RUN_TASKS+=("${UPGRADE_UTILS}/pip-unify.yml -e release_version=\"${NEWTON_RELEASE}\"") @@ -54,6 +61,16 @@ RUN_TASKS+=("${UPGRADE_UTILS}/nova-libvirt-fix.yml") RUN_TASKS+=("lxc-hosts-setup.yml") RUN_TASKS+=("lxc-containers-create.yml") +# Post-setup-hosts hook +if [ -n "$POST_SETUP_HOSTS_HOOK" ]; then + RUN_TASKS+=("$POST_SETUP_HOSTS_HOOK") +fi + +# Pre-setup-infrastructure hook +if [ -n "$PRE_SETUP_INFRASTRUCTURE_HOOK" ]; then + RUN_TASKS+=("$PRE_SETUP_INFRASTRUCTURE_HOOK") +fi + # Setup Infrastructure RUN_TASKS+=("unbound-install.yml") RUN_TASKS+=("repo-install.yml") @@ -69,6 +86,18 @@ RUN_TASKS+=("rsyslog-install.yml") # MariaDB sync for major maria upgrades and cluster schema sync RUN_TASKS+=("${UPGRADE_UTILS}/db-force-upgrade.yml") +# Post-setup-infrastructure hook +if [ -n "$POST_SETUP_INFRASTRUCTURE_HOOK" ]; then + RUN_TASKS+=("$POST_SETUP_INFRASTRUCTURE_HOOK") +fi + +# Pre-setup-openstack hook +if [ -n "$PRE_SETUP_OPENSTACK_HOOK" ]; then + RUN_TASKS+=("$PRE_SETUP_OPENSTACK_HOOK") +fi + +# Setup OpenStack + RUN_TASKS+=("os-keystone-install.yml") RUN_TASKS+=("os-glance-install.yml") RUN_TASKS+=("os-cinder-install.yml") @@ -101,6 +130,12 @@ RUN_TASKS+=("os-magnum-install.yml") RUN_TASKS+=("os-sahara-install.yml") RUN_TASKS+=("${UPGRADE_UTILS}/post-redeploy-cleanup.yml") + +# Post-setup-openstack hook +if [ -n "$POST_SETUP_OPENSTACK_HOOK" ]; then + RUN_TASKS+=("$POST_SETUP_OPENSTACK_HOOK") +fi + # Loads a shell script that can be used to modify # the RUN_TASKS behavior. if [[ ${REDEPLOY_EXTRA_SCRIPT:-} ]]; then