update: support upgrading a subset of nodes

It can be useful in a large cluster deployment to split the upgrade and
only upgrade a group of nodes at a time.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2014304

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/6960/head
Guillaume Abrioux 2021-10-20 10:01:05 +02:00
parent fb8a66149b
commit e5cf9db2b0
2 changed files with 27 additions and 5 deletions

View File

@ -14,6 +14,7 @@
- name: confirm whether user really meant to upgrade the cluster - name: confirm whether user really meant to upgrade the cluster
hosts: localhost hosts: localhost
tags: always
become: false become: false
gather_facts: false gather_facts: false
vars: vars:
@ -47,7 +48,6 @@
- name: gather facts and check the init system - name: gather facts and check the init system
hosts: hosts:
- "{{ mon_group_name|default('mons') }}" - "{{ mon_group_name|default('mons') }}"
- "{{ osd_group_name|default('osds') }}" - "{{ osd_group_name|default('osds') }}"
@ -59,7 +59,7 @@
- "{{ client_group_name|default('clients') }}" - "{{ client_group_name|default('clients') }}"
- "{{ iscsi_gw_group_name|default('iscsigws') }}" - "{{ iscsi_gw_group_name|default('iscsigws') }}"
- "{{ monitoring_group_name|default('monitoring') }}" - "{{ monitoring_group_name|default('monitoring') }}"
tags: always
any_errors_fatal: True any_errors_fatal: True
become: True become: True
gather_facts: False gather_facts: False
@ -136,6 +136,7 @@
rolling_update: true rolling_update: true
- name: upgrade ceph mon cluster - name: upgrade ceph mon cluster
tags: mons
vars: vars:
health_mon_check_retries: 5 health_mon_check_retries: 5
health_mon_check_delay: 15 health_mon_check_delay: 15
@ -314,6 +315,7 @@
- name: reset mon_host - name: reset mon_host
hosts: "{{ mon_group_name|default('mons') }}" hosts: "{{ mon_group_name|default('mons') }}"
tags: always
become: True become: True
gather_facts: false gather_facts: false
tasks: tasks:
@ -331,6 +333,7 @@
health_mon_check_delay: 15 health_mon_check_delay: 15
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: "{{ mon_group_name|default('mons') }}" hosts: "{{ mon_group_name|default('mons') }}"
tags: mgrs
serial: 1 serial: 1
become: True become: True
gather_facts: false gather_facts: false
@ -366,6 +369,7 @@
upgrade_ceph_packages: True upgrade_ceph_packages: True
ceph_release: "{{ ceph_stable_release }}" ceph_release: "{{ ceph_stable_release }}"
hosts: "{{ mgr_group_name|default('mgrs') }}" hosts: "{{ mgr_group_name|default('mgrs') }}"
tags: mgrs
serial: 1 serial: 1
become: True become: True
gather_facts: false gather_facts: false
@ -401,6 +405,7 @@
- name: set osd flags - name: set osd flags
hosts: "{{ mon_group_name | default('mons') }}[0]" hosts: "{{ mon_group_name | default('mons') }}[0]"
tags: osds
become: True become: True
gather_facts: false gather_facts: false
tasks: tasks:
@ -462,8 +467,8 @@
health_osd_check_retries: 40 health_osd_check_retries: 40
health_osd_check_delay: 30 health_osd_check_delay: 30
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: "{{ osd_group_name|default('osds') }}" hosts: "{{ osd_group_name|default('osds') }}"
tags: osds
serial: 1 serial: 1
become: True become: True
gather_facts: false gather_facts: false
@ -539,6 +544,7 @@
- name: complete osd upgrade - name: complete osd upgrade
hosts: "{{ mon_group_name|default('mons') }}[0]" hosts: "{{ mon_group_name|default('mons') }}[0]"
tags: osds
become: True become: True
gather_facts: false gather_facts: false
tasks: tasks:
@ -580,6 +586,7 @@
- name: upgrade ceph mdss cluster, deactivate all rank > 0 - name: upgrade ceph mdss cluster, deactivate all rank > 0
hosts: "{{ mon_group_name | default('mons') }}[0]" hosts: "{{ mon_group_name | default('mons') }}[0]"
tags: mdss
become: true become: true
gather_facts: false gather_facts: false
tasks: tasks:
@ -681,6 +688,7 @@
vars: vars:
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: active_mdss hosts: active_mdss
tags: mdss
become: true become: true
gather_facts: false gather_facts: false
tasks: tasks:
@ -727,6 +735,7 @@
vars: vars:
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: standby_mdss hosts: standby_mdss
tags: mdss
become: True become: True
gather_facts: false gather_facts: false
@ -775,6 +784,7 @@
vars: vars:
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: "{{ rgw_group_name|default('rgws') }}" hosts: "{{ rgw_group_name|default('rgws') }}"
tags: rgws
serial: 1 serial: 1
become: True become: True
gather_facts: false gather_facts: false
@ -819,6 +829,7 @@
vars: vars:
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: "{{ rbdmirror_group_name|default('rbdmirrors') }}" hosts: "{{ rbdmirror_group_name|default('rbdmirrors') }}"
tags: rbdmirrors
serial: 1 serial: 1
become: True become: True
gather_facts: false gather_facts: false
@ -852,6 +863,7 @@
vars: vars:
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: "{{ nfs_group_name|default('nfss') }}" hosts: "{{ nfs_group_name|default('nfss') }}"
tags: nfss
serial: 1 serial: 1
become: True become: True
gather_facts: false gather_facts: false
@ -900,8 +912,8 @@
- name: upgrade ceph iscsi gateway node - name: upgrade ceph iscsi gateway node
vars: vars:
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: hosts: "{{ iscsi_gw_group_name|default('iscsigws') }}"
- "{{ iscsi_gw_group_name|default('iscsigws') }}" tags: iscsigws
serial: 1 serial: 1
become: True become: True
gather_facts: false gather_facts: false
@ -943,6 +955,7 @@
vars: vars:
upgrade_ceph_packages: True upgrade_ceph_packages: True
hosts: "{{ client_group_name|default('clients') }}" hosts: "{{ client_group_name|default('clients') }}"
tags: clients
serial: "{{ client_update_batch | default(20) }}" serial: "{{ client_update_batch | default(20) }}"
become: True become: True
gather_facts: false gather_facts: false
@ -974,6 +987,9 @@
- "{{ rgw_group_name | default('rgws') }}" - "{{ rgw_group_name | default('rgws') }}"
- "{{ rbdmirror_group_name | default('rbdmirrors') }}" - "{{ rbdmirror_group_name | default('rbdmirrors') }}"
- "{{ mgr_group_name | default('mgrs') }}" - "{{ mgr_group_name | default('mgrs') }}"
tags:
- post_upgrade
- crash
gather_facts: false gather_facts: false
become: true become: true
tasks: tasks:
@ -1001,6 +1017,7 @@
- name: complete upgrade - name: complete upgrade
hosts: "{{ mon_group_name | default('mons') }}" hosts: "{{ mon_group_name | default('mons') }}"
tags: post_upgrade
become: True become: True
gather_facts: false gather_facts: false
tasks: tasks:
@ -1037,6 +1054,7 @@
- "{{ nfs_group_name|default('nfss') }}" - "{{ nfs_group_name|default('nfss') }}"
- "{{ iscsi_gw_group_name|default('iscsigws') }}" - "{{ iscsi_gw_group_name|default('iscsigws') }}"
- "{{ monitoring_group_name|default('monitoring') }}" - "{{ monitoring_group_name|default('monitoring') }}"
tags: monitoring
gather_facts: false gather_facts: false
become: true become: true
tasks: tasks:
@ -1067,6 +1085,7 @@
- name: upgrade monitoring node - name: upgrade monitoring node
hosts: "{{ monitoring_group_name }}" hosts: "{{ monitoring_group_name }}"
tags: monitoring
gather_facts: false gather_facts: false
become: true become: true
tasks: tasks:
@ -1098,6 +1117,7 @@
- name: upgrade ceph dashboard - name: upgrade ceph dashboard
hosts: "{{ groups[mgr_group_name] | default(groups[mon_group_name]) | default(omit) }}" hosts: "{{ groups[mgr_group_name] | default(groups[mon_group_name]) | default(omit) }}"
tags: monitoring
gather_facts: false gather_facts: false
become: true become: true
tasks: tasks:
@ -1117,6 +1137,7 @@
- name: switch any existing crush buckets to straw2 - name: switch any existing crush buckets to straw2
hosts: "{{ mon_group_name | default('mons') }}[0]" hosts: "{{ mon_group_name | default('mons') }}[0]"
tags: post_upgrade
become: true become: true
any_errors_fatal: true any_errors_fatal: true
gather_facts: false gather_facts: false
@ -1158,6 +1179,7 @@
- name: show ceph status - name: show ceph status
hosts: "{{ mon_group_name|default('mons') }}" hosts: "{{ mon_group_name|default('mons') }}"
tags: always
become: True become: True
gather_facts: false gather_facts: false
tasks: tasks: