Skip to content

Commit

Permalink
Update example and add a warning
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Schöchlin <[email protected]>
  • Loading branch information
scoopex committed Jun 17, 2024
1 parent 13f711d commit 67c66cb
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions docs/guides/operations-guide/manager/apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,45 @@ resource node. It is saved in the configuration repository in the file
`environments/ceph/playbook-wipe-partitions.yml`. It is run with
`osism apply -e ceph wipe-parititons`.


:::warning

Just to be on the safe side: The following example can be useful, but it can also cause a lot of damage. Be warned!

:::


```yaml title="environments/ceph/playbook-wipe-partitions.yml
---
- name: Wipe partitions
hosts: ceph-resource
gather_facts: false

tasks:
- name: Wipe partitions
- name: Find all logical devices with prefix ceph
ansible.builtin.find:
paths: /dev/mapper
recurse: false
file_type: link
patterns: "ceph*"
register: result

- name: Remove all ceph related logical devices
become: true
ansible.builtin.command: "dmsetup remove {{ item.path }}"
loop: "{{ result.files }}"
changed_when: true

- name: Wipe partitions with wipefs
become: true
ansible.builtin.command: "wipefs --all {{ item }}"
changed_when: true
loop: "{{ ansible_local.testbed_ceph_devices_all }}"

- name: Overwrite first 32M with zeros
become: true
ansible.builtin.shell: |
wipefs --all "{{ item }}"
dd if=/dev/zero of="{{ item }}" bs=1 count=4096
changed_when: false
with_items: "{{ devices }}"
ansible.builtin.command: "dd if=/dev/zero of={{ item }} bs=1M count=32 oflag=direct,dsync"
changed_when: true
loop: "{{ ansible_local.testbed_ceph_devices_all }}"
```

0 comments on commit 67c66cb

Please sign in to comment.