40 lines
1.6 KiB
YAML
40 lines
1.6 KiB
YAML
---
|
|
- name: Reset Ceph Drives
|
|
hosts: kubernetes
|
|
become: true
|
|
gather_facts: true
|
|
any_errors_fatal: true
|
|
pre_tasks:
|
|
- name: Pausing for 2 seconds...
|
|
ansible.builtin.pause:
|
|
seconds: 2
|
|
tasks:
|
|
- name: Reset Ceph Drives # noqa: ignore-errors
|
|
ignore_errors: true
|
|
when: ceph_drives | default([]) | length > 0
|
|
block:
|
|
- name: Delete (/var/lib/rook)
|
|
ansible.builtin.file:
|
|
state: absent
|
|
path: /var/lib/rook
|
|
- name: Delete (/dev/mapper/ceph-*) # noqa: no-changed-when
|
|
ansible.builtin.shell: |
|
|
set -o pipefail
|
|
ls /dev/mapper/ceph-* | xargs -I% -- dmsetup remove_all --force % || true
|
|
- name: Delete (/dev/ceph-*) # noqa: no-changed-when
|
|
ansible.builtin.command: rm -rf /dev/ceph-*
|
|
- name: Delete (/dev/mapper/ceph--*) # noqa: no-changed-when
|
|
ansible.builtin.command: rm -rf /dev/mapper/ceph--*
|
|
- name: Wipe (sgdisk) # noqa: no-changed-when
|
|
ansible.builtin.command: "sgdisk --zap-all {{ item }}"
|
|
loop: "{{ ceph_drives }}"
|
|
- name: Wipe (dd) # noqa: no-changed-when
|
|
ansible.builtin.command: "dd if=/dev/zero of={{ item }} bs=1M count=100 oflag=direct,dsync"
|
|
loop: "{{ ceph_drives }}"
|
|
- name: Wipe (blkdiscard) # noqa: no-changed-when
|
|
ansible.builtin.command: "blkdiscard {{ item }}"
|
|
loop: "{{ ceph_drives }}"
|
|
when: "'nvme' in item"
|
|
- name: Wipe (partprobe) # noqa: no-changed-when
|
|
ansible.builtin.command: "partprobe {{ item }}"
|
|
loop: "{{ ceph_drives }}"
|