Skip ceph update run when update is not required

Improve ceph update run tasks by detecting if ceph update is required
to not start ceph update to the same version. Also exclude ceph images
from container check when update of those containers is not happening.

Change-Id: Idd4132c75208b635c9bf06e28457e02aeb314708
This commit is contained in:
mciecier 2023-02-23 10:25:14 +01:00
parent cfc2debcfe
commit 0fd72e2100
2 changed files with 25 additions and 4 deletions

View File

@ -18,15 +18,35 @@
become_user: root
delegate_to: "{{ inventory_hostmap[controller_role_name]|first }}"
- name: Check if ceph update is required
shell: cephadm shell ceph orch upgrade check {{ image }} | jq .needs_update -r
vars:
image: "{{ container_registry }}/{{ ceph_namespace }}/{{ ceph_image }}:{{ ceph_image_tag }}"
register: ceph_needs_update
become: true
become_user: root
delegate_to: "{{ inventory_hostmap[controller_role_name]|first }}"
- name: Fail before ceph update when ceph cluster is unhealthy
fail:
msg: Ceph update failed because ceph cluster is unhealthy
when: ceph_status.stdout != "HEALTH_OK"
when:
- ceph_status.stdout != "HEALTH_OK"
- ceph_needs_update.stdout != "{}"
- name: import tasks from l3_agent_connectivity_check_start_script
import_tasks: ../common/l3_agent_connectivity_check_start_script.yml
- name: Exclude ceph images from container check when ceph update not required
lineinfile:
path: "{{ log_playbook_script }}-before_reboot.sh"
regexp: "^EXCLUDED_CONTAINERS_FROM_CHECK="
line: "EXCLUDED_CONTAINERS_FROM_CHECK=${2:-{{ excluded_containers_from_check }},ceph}"
state: present
backup: true
when: ceph_needs_update.stdout == "{}"
- block:
- name: import tasks from l3_agent_connectivity_check_start_script
import_tasks: ../common/l3_agent_connectivity_check_start_script.yml
- name: Start Ceph update using cephadm
command:
cmd: >
@ -65,6 +85,7 @@
fail:
msg: Ceph minor update failed
when: ceph_update_status.rc != 0
when: ceph_needs_update.stdout != "{}"
rescue:
- name: print Ceph update failures
command:

View File

@ -4,7 +4,7 @@
CURRENT_STAGE=${1:-{{ log_current_stage }}}
SSH_USER={{ (overcloud_ssh_user) | ternary(overcloud_ssh_user, 'tripleo-admin') }}
EXCLUDED_CONTAINERS_FROM_CHECK=${3:-{{ excluded_containers_from_check }}}
EXCLUDED_CONTAINERS_FROM_CHECK=${2:-{{ excluded_containers_from_check }}}
# This should always be true for tripleo>=wallaby.
if [ ! -f {{ upgrade_validation_inventory }} ]; then