Allow to specify order of roles upgrade.

We always start upgrade from Controllers role, that's a requirement.
Other roles are upgrade in the order in which they apper in
'overcloud' hostgroup from tripleo-ansible-inventory.

So far we cannot guarantee more than upgrading controllers first.
This change introduces new variable 'roles_upgrade_order'
(semi-colon separated list of roles),  which can specify desired order
of roles' upgrade.

WARNING: it's operator's responsibility to specify 'controller'
role as first item of a list.

Example of using 'roles_upgrade_order' variable:
  -e 'roles_upgrade_order=Controller,Database;Networker;Compute'
Here we start upgrade with Controller and Database roles,
 then Networker role and finishing with Compute role.

Default behavior is unchanged: we start by upgrading Controller role,
followed by a roles from tripleo-ansible-inventory.

Change-Id: I8807877990f569cf6eec76e162bc353e8a34ffe8
(cherry picked from commit 34b12e0dee)
This commit is contained in:
Yurii Prokulevych 2019-01-08 14:24:38 +02:00
parent 33537942a0
commit d2dc07e299
2 changed files with 10 additions and 1 deletions

View File

@ -238,5 +238,8 @@ upgrade_remove_rpm: false
# List of roles deployed in overcloud
oc_roles: []
# Roles upgrade order
roles_upgrade_order: '__undefined__'
# Packet loss threshold for a ping test
loss_threshold: 1

View File

@ -21,6 +21,12 @@
when: item|regex_search('[A-Za-z0-9]*[Cc]ontroller[A-Za-z0-9]*')
with_items: "{{ oc_roles }}"
- name: store sorted roles with controller first
- name: store sorted roles with controller first(default)
set_fact:
oc_roles: "{{ oc_roles|intersect([controller_role_name]) + oc_roles|difference([controller_role_name]) }}"
when: roles_upgrade_order == '__undefined__'
- name: store sorted roles with controller first(user-defined)
set_fact:
oc_roles: "{{ roles_upgrade_order.split(';') }}"
when: roles_upgrade_order != '__undefined__'