Skip to content

Commit

Permalink
Add pre- and post- stage hooks to leap redeploy process
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jesse Pretorius committed Aug 26, 2017
1 parent b7f4419 commit 9049479
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions leap-upgrades/re-deploy.sh
Expand Up @@ -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}\"")
Expand All @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9049479

Please sign in to comment.