openstack-ansible-ops/leap-upgrades/prep.sh
Jean-Philippe Evrard b77287b87f redeploy should be done in the proper folder
run_ansible wrapper should work in the latest checkout of OA,
which should be in a REDEPLOY folder instead of just
a static "/opt/openstack-ansible"

Change-Id: I4d20fd7480f2f38e55d3f081c0c0f11726458583
2017-08-30 13:59:30 +00:00

76 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2017, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## Shell Opts ----------------------------------------------------------------
set -e -u
## Main ----------------------------------------------------------------------
source lib/vars.sh
source lib/functions.sh
# Execute a preflight check
pre_flight
# Clone the Juno release so we have a clean copy of the source code.
if [[ ! -f "/opt/leap42/openstack-ansible-${JUNO_RELEASE}-prep.leap" ]]; then
clone_release ${JUNO_RELEASE}
touch "/opt/leap42/openstack-ansible-${JUNO_RELEASE}-prep.leap"
fi
# Build the releases. This will clone all of the releases and check them out
# separately in addition to creating all of the venvs needed for a successful migration.
if [[ ! -f "/opt/leap42/openstack-ansible-${KILO_RELEASE}-prep.leap" ]]; then
clone_release ${KILO_RELEASE}
get_venv ${KILO_RELEASE}
touch "/opt/leap42/openstack-ansible-${KILO_RELEASE}-prep.leap"
fi
if [[ ! -f "/opt/leap42/openstack-ansible-${LIBERTY_RELEASE}-prep.leap" ]]; then
clone_release ${LIBERTY_RELEASE}
get_venv ${LIBERTY_RELEASE}
touch "/opt/leap42/openstack-ansible-${LIBERTY_RELEASE}-prep.leap"
fi
if [[ ! -f "/opt/leap42/openstack-ansible-${MITAKA_RELEASE}-prep.leap" ]]; then
clone_release ${MITAKA_RELEASE}
get_venv ${MITAKA_RELEASE}
touch "/opt/leap42/openstack-ansible-${MITAKA_RELEASE}-prep.leap"
fi
if [[ ! -f "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap" ]]; then
clone_release ${NEWTON_RELEASE}
get_venv ${NEWTON_RELEASE}
touch "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}-prep.leap"
fi
if [[ ! -f "/opt/leap42/openstack-ansible-prep-finalsteps.leap" ]]; then
RUN_TASKS=()
RUN_TASKS+=("${UPGRADE_UTILS}/cinder-volume-container-lvm-check.yml")
RUN_TASKS+=("${UPGRADE_UTILS}/db-backup.yml")
# temp upgrade ansible is used to ensure 1.9.x compat.
PS1="\\u@\h \\W]\\$" . "/opt/ansible-runtime/bin/activate"
run_items "/opt/leap42/openstack-ansible-${RELEASE}"
deactivate
unset ANSIBLE_INVENTORY
link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}"
bootstrap_recent_ansible
touch "/opt/leap42/openstack-ansible-prep-finalsteps.leap"
fi