89c5f26e21f6f7437483b01aa63cf390321a6488
[ta/infra-ansible.git] / playbooks / destroy_data_and_partitions.yml
1 ---
2
3 # Copyright 2019 Nokia
4
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 - name: wipe off filesystems from disks
18   shell: "[ -b {{ item }} ] | /usr/sbin/wipefs --all --force {{ item }} || /usr/sbin/wipefs --all --force {{ item }}"
19   args:
20     creates: /etc/storage/osd_disk_metadata.json
21   with_items: "{{ disks }}"
22
23 - name: destroy data from disks
24   shell: "[ -b {{ item }} ] | dd if=/dev/zero of={{ item }} count=200 bs=1M"
25   args:
26     creates: /etc/storage/osd_disk_metadata.json
27   with_items: "{{ disks }}"
28
29 - name: destroy partitions from disks
30   shell: "[ -b {{ item }} ] | /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -- {{ item }} || /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -- {{ item }}"
31   args:
32     creates: /etc/storage/osd_disk_metadata.json
33   with_items: "{{ disks }}"