Skip to content

Commit b1b1895

Browse files
committed
feat: add cephadm maintenance playbooks
1 parent 109649a commit b1b1895

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
- name: Ensure a Ceph host has entered host maintenance
3+
gather_facts: true
4+
hosts: ceph
5+
become: true
6+
tasks:
7+
- name: Check if host can enter maintenance mode
8+
import_role:
9+
name: stackhpc.cephadm.commands
10+
vars:
11+
cephadm_commands:
12+
- "orch host ok-to-stop {{ ansible_facts.nodename }}"
13+
14+
- block:
15+
- name: Extract full name of active Ceph manager
16+
ansible.builtin.set_fact:
17+
active_ceph_mgr: "{{ cephadm_commands_result.results[0].stderr | split | last | replace(\"'\",'') }}"
18+
19+
- name: Ensure active manager has been switched to another node
20+
import_role:
21+
name: stackhpc.cephadm.commands
22+
vars:
23+
cephadm_commands:
24+
- "mgr fail {{ active_ceph_mgr }}"
25+
when: '"Cannot stop active Mgr daemon" in cephadm_commands_result.results[0].stderr'
26+
27+
- name: Ensure host is in maintenance mode
28+
import_role:
29+
name: stackhpc.cephadm.commands
30+
vars:
31+
cephadm_commands:
32+
- "orch host maintenance enter {{ ansible_facts.nodename }}"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Ensure a Ceph host has exited host maintenance
3+
gather_facts: true
4+
hosts: ceph
5+
become: true
6+
tasks:
7+
- import_role:
8+
name: stackhpc.cephadm.commands
9+
vars:
10+
cephadm_commands:
11+
- "orch host maintenance exit {{ ansible_facts.nodename }}"

0 commit comments

Comments
 (0)