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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 - name: check whether disks exist and are block devices
18 stat: path={{ item }} follow=true
19 with_items: "{{ disks }}"
22 - name: wipe off filesystems from disks
23 command: "/usr/sbin/wipefs --all --force {{ item.item }}"
25 creates: "{{ creates_file }}"
26 with_items: "{{ disks_stat.results }}"
27 when: item.stat.exists and item.stat.isblk
29 - name: destroy data from disks
30 command: "dd if=/dev/zero of={{ item.item }} count=200 bs=1M"
32 creates: "{{ creates_file }}"
33 with_items: "{{ disks_stat.results }}"
34 when: item.stat.exists and item.stat.isblk
36 - name: destroy partitions from disks
37 command: "/usr/sbin/sgdisk --zap-all --clear --mbrtogpt -- {{ item.item }}"
39 creates: "{{ creates_file }}"
40 with_items: "{{ disks_stat.results }}"
41 when: item.stat.exists and item.stat.isblk