]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | |
2 | - hosts: osds | |
3 | become: yes | |
4 | tasks: | |
5 | ||
6 | - name: stop ceph-osd@2 daemon | |
7 | service: | |
8 | name: ceph-osd@2 | |
9 | state: stopped | |
10 | ||
28e407b8 AA |
11 | - name: stop ceph-osd@0 daemon |
12 | service: | |
13 | name: ceph-osd@0 | |
14 | state: stopped | |
15 | ||
16 | ||
17 | - hosts: mons | |
18 | become: yes | |
19 | tasks: | |
20 | ||
94b18763 | 21 | - name: destroy osd.2 |
91327a77 | 22 | command: "ceph --cluster {{ cluster }} osd destroy osd.2 --yes-i-really-mean-it" |
b32b8144 | 23 | |
28e407b8 | 24 | - name: destroy osd.0 |
91327a77 | 25 | command: "ceph --cluster {{ cluster }} osd destroy osd.0 --yes-i-really-mean-it" |
28e407b8 AA |
26 | |
27 | ||
28 | - hosts: osds | |
29 | become: yes | |
30 | tasks: | |
31 | ||
32 | # osd.2 device | |
94b18763 | 33 | - name: zap /dev/sdd1 |
91327a77 | 34 | command: "ceph-volume --cluster {{ cluster }} lvm zap /dev/sdd1 --destroy" |
b32b8144 FG |
35 | environment: |
36 | CEPH_VOLUME_DEBUG: 1 | |
37 | ||
94b18763 | 38 | - name: redeploy osd.2 using /dev/sdd1 |
91327a77 | 39 | command: "ceph-volume --cluster {{ cluster }} lvm create --bluestore --data /dev/sdd1 --osd-id 2" |
b32b8144 FG |
40 | environment: |
41 | CEPH_VOLUME_DEBUG: 1 | |
94b18763 | 42 | |
91327a77 | 43 | # osd.0 device (zap without --destroy that removes the LV) |
94b18763 | 44 | - name: zap test_group/data-lv1 |
91327a77 | 45 | command: "ceph-volume --cluster {{ cluster }} lvm zap test_group/data-lv1" |
94b18763 FG |
46 | environment: |
47 | CEPH_VOLUME_DEBUG: 1 | |
48 | ||
49 | - name: prepare osd.0 again using test_group/data-lv1 | |
91327a77 | 50 | command: "ceph-volume --cluster {{ cluster }} lvm prepare --bluestore --data test_group/data-lv1 --osd-id 0" |
94b18763 FG |
51 | environment: |
52 | CEPH_VOLUME_DEBUG: 1 | |
53 | ||
54 | - name: activate all to start the previously prepared osd.0 | |
55 | command: "ceph-volume lvm activate --all" | |
56 | environment: | |
57 | CEPH_VOLUME_DEBUG: 1 | |
1adf2230 AA |
58 | |
59 | - name: list all OSDs | |
60 | command: "ceph-volume lvm list" | |
61 | environment: | |
62 | CEPH_VOLUME_DEBUG: 1 | |
91327a77 AA |
63 | |
64 | - name: create temporary directory | |
65 | tempfile: | |
66 | state: directory | |
67 | suffix: sparse | |
68 | register: tmpdir | |
69 | ||
70 | - name: create a 5GB sparse file | |
71 | command: fallocate -l 5G {{ tmpdir.path }}/sparse.file | |
72 | ||
73 | - name: find an empty loop device | |
74 | command: losetup -f | |
75 | register: losetup_list | |
76 | ||
77 | - name: setup loop device with sparse file | |
78 | command: losetup {{ losetup_list.stdout }} {{ tmpdir.path }}/sparse.file | |
79 | ||
80 | - name: create volume group | |
81 | command: vgcreate test_zap {{ losetup_list.stdout }} | |
82 | failed_when: false | |
83 | ||
84 | - name: create logical volume 1 | |
85 | command: lvcreate --yes -l 50%FREE -n data-lv1 test_zap | |
86 | failed_when: false | |
87 | ||
88 | - name: create logical volume 2 | |
89 | command: lvcreate --yes -l 50%FREE -n data-lv2 test_zap | |
90 | failed_when: false | |
91 | ||
92 | # zapping the first lv shouldn't remove the vg, allowing the second zap to succeed | |
93 | - name: zap test_zap/data-lv1 | |
94 | command: "ceph-volume --cluster {{ cluster }} lvm zap --destroy test_zap/data-lv1" | |
95 | environment: | |
96 | CEPH_VOLUME_DEBUG: 1 | |
97 | ||
98 | - name: zap test_zap/data-lv2 | |
99 | command: "ceph-volume --cluster {{ cluster }} lvm zap --destroy test_zap/data-lv2" | |
100 | environment: | |
101 | CEPH_VOLUME_DEBUG: 1 |