From a476a4037f3e459431f7de9fa1abc286c8769c4a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Wed, 30 Aug 2017 10:00:57 +0000 Subject: [PATCH] Allow overrides of bootstrap ansible script Some providers may have a different bootstrapping script, and probably want to use their own instead of always bootstrapping the OSA one for the leap. We should be able to give a script as env var, and use that script for installing an ansible that works for leapfrog. Change-Id: I034d3dace52ae092e04d4573c6299b464153084d --- leap-upgrades/lib/functions.sh | 12 ++++++++++-- leap-upgrades/lib/vars.sh | 3 +++ leap-upgrades/prep.sh | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/leap-upgrades/lib/functions.sh b/leap-upgrades/lib/functions.sh index d4e07eb3..eeab4153 100644 --- a/leap-upgrades/lib/functions.sh +++ b/leap-upgrades/lib/functions.sh @@ -97,7 +97,15 @@ function run_lock { set -e } -function system_bootstrap { +function bootstrap_recent_ansible { + # This ensures that old ansible will be removed + # and that we have a recent enough Ansible version for: + # - the variable upgrades + # - the db migrations + # - the host upgrade + # - the neutron container forget + # - the re deploy, if there was no hook that + # redeployed ansible if [[ -d "/opt/ansible-runtime" ]]; then rm -rf "/opt/ansible-runtime" else @@ -117,7 +125,7 @@ function system_bootstrap { notice "Removed System installed Ansible" done - pushd "$1" + pushd "${BOOTSTRAP_ANSIBLE_FOLDER}" # Install ansible for system migrations scripts/bootstrap-ansible.sh popd diff --git a/leap-upgrades/lib/vars.sh b/leap-upgrades/lib/vars.sh index 51850d8b..add340d4 100644 --- a/leap-upgrades/lib/vars.sh +++ b/leap-upgrades/lib/vars.sh @@ -40,6 +40,9 @@ export VALIDATE_UPGRADE_INPUT="${VALIDATE_UPGRADE_INPUT:-TRUE}" export UPGRADES_TO_TODOLIST="${UPGRADES_TO_TODOLIST:-''}" export CODE_UPGRADE_FROM="" +# Bootstrap ansible tool, see also bootstrap_recent_ansible +export BOOTSTRAP_ANSIBLE_FOLDER=${BOOTSTRAP_ANSIBLE_FOLDER:-/opt/openstack-ansible/} + ## Ansible debugging export LEAP_TIMESTAMP=$(date +%s) export ANSIBLE_LOG_PATH="/opt/leap42/ansible-${LEAP_TIMESTAMP}.log" diff --git a/leap-upgrades/prep.sh b/leap-upgrades/prep.sh index 5e9abd54..8abc7c95 100755 --- a/leap-upgrades/prep.sh +++ b/leap-upgrades/prep.sh @@ -73,6 +73,6 @@ if [[ ! -f "/opt/leap42/openstack-ansible-prep-finalsteps.leap" ]]; then unset ANSIBLE_INVENTORY link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}" - system_bootstrap "/opt/openstack-ansible" + bootstrap_recent_ansible touch "/opt/leap42/openstack-ansible-prep-finalsteps.leap" fi