]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge: support osd_auto_discovery
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 21 Jul 2021 21:16:59 +0000 (23:16 +0200)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Thu, 22 Jul 2021 16:43:57 +0000 (12:43 -0400)
This adds a task that zaps by osd id so we can support the scenario
where osds were deployed with `osd_auto_discovery` is true.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1876860
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 4144074a50ffd1e8893e3af2242fc44a23fd9c3e)

infrastructure-playbooks/purge-cluster.yml

index 3ed5358fcc79568753abf47dbddd8b264176d316..d5fc80352eaa014e0d2945ab52485b21a7588b60 100644 (file)
       shell: "sync && sleep 1 && echo 3 > /proc/sys/vm/drop_caches"
       changed_when: false
 
+    - name: see if ceph-volume is installed # noqa : 305
+      shell: command -v ceph-volume
+      changed_when: false
+      failed_when: false
+      register: ceph_volume_present
+      when: not containerized_deployment | bool
+
+    - name: zap and destroy osds by osd ids
+      ceph_volume:
+        osd_id: "{{ item | int }}"
+        action: "zap"
+      environment:
+        CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}"
+        CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
+        CEPH_CONTAINER_BINARY: "{{ container_binary }}"
+      with_items: "{{ osd_ids.stdout_lines }}"
+      when:
+        - osd_auto_discovery | default(False) | bool
+        - (containerized_deployment | bool or ceph_volume_present.rc == 0)
+
     - name: umount osd data partition
       mount:
         path: "{{ item }}"