Skip to content

feat: add cephadm maintenance playbooks #696

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

Closed
wants to merge 4 commits into from
Closed
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
32 changes: 32 additions & 0 deletions etc/kayobe/ansible/cephadm-enter-maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
- name: Ensure a Ceph host has entered host maintenance
gather_facts: true
hosts: ceph
become: true
tasks:
- name: Check if host can enter maintenance mode
ansible.builtin.import_role:
name: stackhpc.cephadm.commands
vars:
cephadm_commands:
- "orch host ok-to-stop {{ ansible_facts.nodename }}"

- block:
- name: Extract full name of active Ceph manager
ansible.builtin.set_fact:
active_ceph_mgr: "{{ cephadm_commands_result.results[0].stderr | split | last | replace(\"'\",'') }}"

- name: Ensure active manager has been switched to another node
ansible.builtin.import_role:
name: stackhpc.cephadm.commands
vars:
cephadm_commands:
- "mgr fail {{ active_ceph_mgr }}"
when: '"Cannot stop active Mgr daemon" in cephadm_commands_result.results[0].stderr'

- name: Ensure host is in maintenance mode
ansible.builtin.import_role:
name: stackhpc.cephadm.commands
vars:
cephadm_commands:
- "orch host maintenance enter {{ ansible_facts.nodename }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't be possible for any host holding RGW services - gets:

WARNING: Removing RGW daemons can cause clients to lose connectivity.
Note: Warnings can be bypassed with the --force flag

Of course --force defeats the purpose of other checks and is not viable here.

11 changes: 11 additions & 0 deletions etc/kayobe/ansible/cephadm-exit-maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Ensure a Ceph host has exited host maintenance
gather_facts: true
hosts: ceph
become: true
tasks:
- ansible.builtin.import_role:
name: stackhpc.cephadm.commands
vars:
cephadm_commands:
- "orch host maintenance exit {{ ansible_facts.nodename }}"