Update: Ensure parallel execution

In middle of Queens and Rocky release we introduced option to
set parallel execution of minor update on selected role types.
If the environment went through FFWD or was deployed before this
option got backported we need to update the roles_data.

By default we have update_serial either unset at all for OSP13 and OSP14 or
we have it set where Pacemaker enabled nodes, CephOSD nodes and Networkers
have it set to 1. This is mostly defensive precaution and we do allow running
in parallel for CephOSD and Networkers for production systems that did enough
testing on preprod or can take small outage. We should also parallelize it in
CI as we just waste time here.

Change-Id: I4cff09dc6aa9ac944b20a52ae087a8923f55209f
(cherry picked from commit 2044957694)
(cherry picked from commit ad0e9b3954)
This commit is contained in:
Lukas Bezdicka 2019-11-24 17:45:58 +01:00
parent f56d7e3477
commit 405e250996
1 changed files with 30 additions and 0 deletions

View File

@ -28,3 +28,33 @@
line: '\1- OS::TripleO::Services::CephMgr\n\1\2'
insertbefore: '- OS::TripleO::Services::CephMon'
when: ceph_mgr_found.rc == 1
# By default we have update_serial either unset at all for OSP13 and OSP14 or
# we have it set where Pacemaker enabled nodes, CephOSD nodes and Networkers
# have it set to 1. This is mostly defensive precaution and we do allow running
# in parallel for CephOSD and Networkers for production systems that did enough
# testing on preprod or can take small outage. We should also parallelize it in
# CI as we just waste time here.
#
# save roles_data
# remove all update_serial
# add update_serial: 25
# set update_serial to 1 on roles with OS::TripleO::Services::Pacemaker
# write new roles_data
- name: Ensure we set update_serial in roles data
shell: |
set -o pipefail
if grep -q OS::TripleO::Services::Pacemaker "{{ roles_data }}" ; then
cp -f "{{ roles_data }}" "{{ roles_data }}_update_serial"
python -c 'import sys, yaml, simplejson as json;
json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < "{{roles_data}}_update_serial" |\
jq 'del(.[] | .update_serial)' |\
jq 'map(. |= (. += {update_serial: 25} ))' |\
jq 'map( if .ServicesDefault | contains (["OS::TripleO::Services::Pacemaker"])
then .update_serial = 1 else . end)' |\
python -c 'import simplejson, sys, yaml;
print yaml.dump(simplejson.loads(str(sys.stdin.read())),
default_flow_style=False)' > "{{ roles_data }}"
else
echo "No service defined, not modifying the role file"
fi