blob: 2581f5c4615688f6d87e31a2145fafc19f859758 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
- hosts: osds
become: yes
tasks:
- name: stop ceph-osd daemons
service:
name: "ceph-osd@{{ item }}"
state: stopped
with_items: "{{ osd_ids }}"
- hosts: mons
become: yes
tasks:
- name: mark osds down
command: "ceph osd down osd.{{ item }}"
with_items: "{{ osd_ids }}"
- name: purge osds
command: "ceph osd purge osd.{{ item }} --yes-i-really-mean-it"
with_items: "{{ osd_ids }}"
- hosts: osds
become: yes
vars:
external_devices: "{{ '--db-devices' if osd_objectstore == 'bluestore' else '--journal-devices' }}"
tasks:
- name: zap devices used for OSDs
command: "ceph-volume lvm zap {{ item }} --destroy"
with_items: "{{ devices }}"
environment:
CEPH_VOLUME_DEBUG: 1
- name: batch create devices again
command: "ceph-volume lvm batch --yes --{{ osd_objectstore|default('bluestore') }} {{ '--dmcrypt' if dmcrypt|default(false) else '' }} {{ devices[:2] | join(' ') }} {{ external_devices }} {{ devices[2:] | join(' ') }}"
environment:
CEPH_VOLUME_DEBUG: 1
- name: ensure batch create is idempotent when all data devices are filtered
command: "ceph-volume lvm batch --yes --{{ osd_objectstore|default('bluestore') }} {{ '--dmcrypt' if dmcrypt|default(false) else '' }} {{ devices[:2] | join(' ') }} {{ external_devices }} {{ devices[2:] | join(' ') }}"
register: batch_cmd
failed_when: false
environment:
CEPH_VOLUME_DEBUG: 1
- name: check batch idempotency
fail:
msg: "lvm batch failed idempotency check"
when:
- batch_cmd.rc != 0
- name: run batch --report to see if devices get filtered
command: "ceph-volume lvm batch --report --format=json --{{ osd_objectstore|default('bluestore') }} {{ '--dmcrypt' if dmcrypt|default(false) else '' }} {{ devices[:2] | join(' ') }} {{ external_devices }} {{ devices[2:] | join(' ') }}"
register: report_cmd
failed_when: false
environment:
CEPH_VOLUME_DEBUG: 1
- name: check batch --report idempotency
fail:
msg: "lvm batch --report failed idempotency check"
when:
- report_cmd.rc != 0
|