mirror of
https://github.com/auricom/home-cluster.git
synced 2025-09-17 18:24:14 +02:00
feat: rook-ceph nuke playbook
This commit is contained in:
@@ -7,3 +7,9 @@ ansible_user: "ubuntu"
|
||||
# ansible_ssh_pass: "ubuntu"
|
||||
# ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null"
|
||||
# ansible_become_pass: "ubuntu"
|
||||
|
||||
# Set enabled to true to mark this host as running a distributed storage rook-ceph
|
||||
rook_ceph:
|
||||
enabled: true
|
||||
devices:
|
||||
- /dev/nvme0n1
|
@@ -7,3 +7,9 @@ ansible_user: "ubuntu"
|
||||
# ansible_ssh_pass: "ubuntu"
|
||||
# ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null"
|
||||
# ansible_become_pass: "ubuntu"
|
||||
|
||||
# Set enabled to true to mark this host as running a distributed storage rook-ceph
|
||||
rook_ceph:
|
||||
enabled: true
|
||||
devices:
|
||||
- /dev/nvme0n1
|
@@ -7,3 +7,9 @@ ansible_user: "ubuntu"
|
||||
# ansible_ssh_pass: "ubuntu"
|
||||
# ansible_ssh_common_args: "-o UserKnownHostsFile=/dev/null"
|
||||
# ansible_become_pass: "ubuntu"
|
||||
|
||||
# Set enabled to true to mark this host as running a distributed storage rook-ceph
|
||||
rook_ceph:
|
||||
enabled: true
|
||||
devices:
|
||||
- /dev/nvme0n1
|
48
server/ansible/playbooks/rook-ceph/nuke.yaml
Normal file
48
server/ansible/playbooks/rook-ceph/nuke.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
|
||||
- hosts:
|
||||
- worker-nodes
|
||||
become: true
|
||||
gather_facts: true
|
||||
any_errors_fatal: true
|
||||
pre_tasks:
|
||||
- name: Pausing for 5 seconds...
|
||||
pause:
|
||||
seconds: 5
|
||||
tasks:
|
||||
- name: remove /var/lib/rook
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
path: "/var/lib/rook"
|
||||
when:
|
||||
- rook_ceph.enabled is defined
|
||||
- rook_ceph.enabled
|
||||
- name: zap the drives
|
||||
become: true
|
||||
ansible.builtin.shell: >
|
||||
sgdisk --zap-all {{ item }} || true
|
||||
loop:
|
||||
- "{{ rook_ceph.devices }}"
|
||||
when:
|
||||
- rook_ceph.enabled is defined
|
||||
- rook_ceph.enabled
|
||||
- name: remove lvm partitions
|
||||
become: true
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
loop:
|
||||
- ls /dev/mapper/ceph--* | xargs -I% -- fuser --kill %
|
||||
- ls /dev/mapper/ceph--* | xargs -I% -- dmsetup clear %
|
||||
- ls /dev/mapper/ceph--* | xargs -I% -- dmsetup remove -f %
|
||||
- ls /dev/mapper/ceph--* | xargs -I% -- rm -rf %
|
||||
when:
|
||||
- rook_ceph.enabled is defined
|
||||
- rook_ceph.enabled
|
||||
- name: wipe the block device
|
||||
become: true
|
||||
ansible.builtin.command: "wipefs -af {{ item }}"
|
||||
with_items:
|
||||
- "{{ rook_ceph.devices }}"
|
||||
when:
|
||||
- rook_ceph.enabled is defined
|
||||
- rook_ceph.enabled
|
Reference in New Issue
Block a user