Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Insure ceph orch upgrade #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions playbooks/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@
- ceph-osd
environment:
CEPHADM_IMAGE: "{{ cephadm_image | default('quay.io/ceph/ceph:v' + (ceph_version | default('18.2.1'))) }}"

- name: Upgrade check
hosts: "{{ ceph_control_plane_group | default('controllers') }}"
become: true
roles:
- role: upgrade_check
tags:
- ceph-upgrade-check
environment:
CEPHADM_IMAGE: "{{ cephadm_image | default('quay.io/ceph/ceph:v' + (ceph_version | default('18.2.1'))) }}"
1 change: 1 addition & 0 deletions roles/upgrade_check/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `ceph_upgrade_check`
16 changes: 16 additions & 0 deletions roles/upgrade_check/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2023 VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

# Filesystem ID
ceph_mon_fsid: "{{ ceph_fsid }}"
28 changes: 28 additions & 0 deletions roles/upgrade_check/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2024 VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

galaxy_info:
author: VEXXHOST, Inc.
description: Ansible role for Ceph monitor
license: Apache-2.0
min_ansible_version: 5.5.0
standalone: false
platforms:
- name: Ubuntu
versions:
- focal
- jammy

dependencies:
- role: cephadm
46 changes: 46 additions & 0 deletions roles/upgrade_check/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) 2022 VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

- name: Get ceph version
run_once: true
ansible.builtin.command: cephadm shell --fsid "{{ ceph_mon_fsid }}" -- ceph version
register: cluster_version
changed_when: false

- name: Check upgrade version
run_once: true
ansible.builtin.set_fact:
check_upgrade: "{{ (cluster_version | regex_search('[0-9]+\\.[0-9]+\\.[0-9]+')) is version(ceph_version, '<') }}"

- name: Run upgrade
when:
- check_upgrade
run_once: true
ansible.builtin.command: |
cephadm shell
--fsid "{{ ceph_mon_fsid }}"
-- ceph orch upgrade start --ceph-version "{{ ceph_version }}"
register: result
changed_when: "'Initiating upgrade' in result.stdout"

- name: Wait until Ceph upgraded
when:
- check_upgrade
run_once: true
ansible.builtin.command: cephadm shell --fsid "{{ ceph_mon_fsid }}" -- ceph version
register: _cluster_version
until: "(_cluster_version | regex_search('[0-9]+\\.[0-9]+\\.[0-9]+')) is version(ceph_version, '==')"
retries: "{{ ceph_upgrade_check_retry | default(120) }}"
delay: 10
changed_when: false
Loading