]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
shrink_osd: remove osd data directory
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 22 Jul 2020 14:08:15 +0000 (16:08 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 3 Aug 2020 12:46:56 +0000 (14:46 +0200)
Otherwise it leaves an empty directory.
When shrinking and redeploying multiple OSDs you have no guarantee it
will reuse the same osd id.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
infrastructure-playbooks/shrink-osd.yml

index 88f7de4c2fb8ac4f29e201d6c9151bf2788b1628..ff9f4dcd2e0a1c51784051845a22103a4aed151c 100644 (file)
     - name: umount osd lockbox
       mount:
         path: "/var/lib/ceph/osd-lockbox/{{ ceph_osd_data_json[item.2]['data']['uuid'] }}"
-        state: unmounted
+        state: absent
       loop: "{{ _osd_hosts }}"
       delegate_to: "{{ item.0 }}"
       when:
     - name: umount osd data
       mount:
         path: "/var/lib/ceph/osd/{{ cluster }}-{{ item.2 }}"
-        state: unmounted
+        state: absent
       loop: "{{ _osd_hosts }}"
       delegate_to: "{{ item.0 }}"
-      when:
-        - not containerized_deployment | bool
-        - item.2 not in _lvm_list.keys()
+      when: not containerized_deployment | bool
 
     - name: get parent device for data partition
       command: lsblk --noheadings --output PKNAME --nodeps "{{ ceph_osd_data_json[item.2]['data']['path'] }}"
       run_once: true
       with_items: "{{ osd_to_kill.split(',') }}"
 
+    - name: remove osd data dir
+      file:
+        path: "/var/lib/ceph/osd/{{ cluster }}-{{ item.2 }}"
+        state: absent
+      loop: "{{ _osd_hosts }}"
+      delegate_to: "{{ item.0 }}"
+
     - name: show ceph health
       command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} -s"