Include P-Q changes into the upgrade script

We need to include changes in the upgrade script to handle
the changes done during the Queens timeframe:

- Inventory is fixed to prevent a stacktrace if a container
  default was moved from is_metal: False to is_metal: True,
  and now respects existing container properties.
- Ensuring previous inventory location isn't overriding the
  Queens inventory location in memory, by unsetting
  ANSIBLE_INVENTORY.
- Ensuring all containers are using the repo that was build
  during the upgrade.

Change-Id: I0fd3a8803bf345ccad07dc97968e104cd0a7bf70
Partial-Bug: #1741462
Closes-Bug: #1675810
This commit is contained in:
Jean-Philippe Evrard 2018-01-04 10:43:26 +00:00
parent 03d2f664be
commit 81e1f8d173
3 changed files with 48 additions and 20 deletions

View File

@ -38,6 +38,22 @@ From the ``openstack-ansible`` root directory, run the following commands:
# export SCRIPTS_PATH="${MAIN_PATH}/scripts"
# export UPGRADE_PLAYBOOKS="${SCRIPTS_PATH}/upgrade-utilities/playbooks"
Deal with existing OpenStack-Ansible artifacts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The deployment node may have previous branch artifacts.
Unset the following environment variables first:
.. code-block:: console
# unset ANSIBLE_INVENTORY
Optionally, take a backup of your environment:
.. code-block:: console
# tar zcf /openstack/previous-ansible_`date +%F_%H%M`.tar.gz /etc/openstack_deploy /etc/ansible/ /usr/local/bin/openstack-ansible.rc
Bootstrap Ansible again
~~~~~~~~~~~~~~~~~~~~~~~
@ -167,15 +183,6 @@ fashion.
# openstack-ansible "${UPGRADE_PLAYBOOKS}/galera-cluster-rolling-restart.yml"
Update HAProxy configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Install and update any new or changed HAProxy service configurations.
.. code-block:: console
# openstack-ansible haproxy-install.yml
Update repository servers
~~~~~~~~~~~~~~~~~~~~~~~~~
@ -186,6 +193,24 @@ required by the |current_release_formal_name| release.
# openstack-ansible repo-install.yml
Update HAProxy configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Install and update any new or changed HAProxy service configurations.
.. code-block:: console
# openstack-ansible haproxy-install.yml
Use the repository servers
~~~~~~~~~~~~~~~~~~~~~~~~~~
Now all containers can be pointed to the repo server's VIPs.
.. code-block:: console
# openstack-ansible repo-use.yml
Upgrade the MariaDB version
~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -217,7 +217,6 @@ def _build_container_hosts(container_affinity, container_hosts, type_and_name,
du.append_if(array=container_mapping, item=host_type_containers)
hostvars_options.update({
'properties': properties,
'ansible_host': address,
'container_address': address,
'container_name': container_host_name,
@ -225,6 +224,8 @@ def _build_container_hosts(container_affinity, container_hosts, type_and_name,
'physical_host_group': physical_host_type,
'component': assignment
})
if 'properties' not in hostvars_options:
hostvars_options['properties'] = properties
def _append_container_types(inventory, host_type):
@ -810,7 +811,7 @@ def _ensure_inventory_uptodate(inventory, container_skel):
if hosts:
for host in hosts:
container = host_vars[host]
if 'properties' in type_vars:
if 'properties' in type_vars and 'properties' not in container:
logger.debug("Copied propeties for %s from skeleton",
container)
container['properties'] = type_vars['properties']

View File

@ -162,13 +162,14 @@ function main {
pre_flight
check_for_current
"${SCRIPTS_PATH}/bootstrap-ansible.sh"
# ANSIBLE_INVENTORY location has changed between P and Q, so we ensure
# we don't point to previous inventory.
unset ANSIBLE_INVENTORY
# Unset environment variables used by the override_folder
# plugin to set paths for group and host vars since the
# default locations have changed between Ocata and Pike.
unset GROUP_VARS_PATH
unset HOST_VARS_PATH
# Archive previous version artifacts
tar zcf /openstack/previous-ansible_`date +%F_%H%M`.tar.gz /etc/openstack_deploy /etc/ansible/ /usr/local/bin/openstack-ansible.rc
"${SCRIPTS_PATH}/bootstrap-ansible.sh"
pushd ${MAIN_PATH}/playbooks
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/ansible_fact_cleanup.yml")
@ -180,15 +181,16 @@ function main {
RUN_TASKS+=("setup-hosts.yml --limit '!galera_all'")
# add new container config to galera containers but don't restart
RUN_TASKS+=("lxc-containers-create.yml -e 'lxc_container_allow_restarts=false' --limit galera_all")
RUN_TASKS+=("haproxy-install.yml")
# rebuild the repo servers
# setup infra
RUN_TASKS+=("unbound-install.yml")
RUN_TASKS+=("repo-install.yml")
RUN_TASKS+=("haproxy-install.yml")
RUN_TASKS+=("repo-use.yml")
# explicitly perform mariadb upgrade
RUN_TASKS+=("galera-install.yml -e 'galera_upgrade=true'")
# explicitly perform controlled galera cluster restart
RUN_TASKS+=("${UPGRADE_PLAYBOOKS}/galera-cluster-rolling-restart.yml")
# individually run each of the remaining plays from setup-infrastructure
RUN_TASKS+=("unbound-install.yml")
RUN_TASKS+=("memcached-install.yml")
RUN_TASKS+=("rabbitmq-install.yml -e 'rabbitmq_upgrade=true'")
RUN_TASKS+=("etcd-install.yml")