Code Review
/
ta
/
infra-ansible.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
More security compliance modifications
[ta/infra-ansible.git]
/
playbooks
/
destroy_data_and_partitions.yml
diff --git
a/playbooks/destroy_data_and_partitions.yml
b/playbooks/destroy_data_and_partitions.yml
index
89c5f26
..
a9de015
100644
(file)
--- a/
playbooks/destroy_data_and_partitions.yml
+++ b/
playbooks/destroy_data_and_partitions.yml
@@
-14,20
+14,28
@@
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+- name: check whether disks exist and are block devices
+ stat: path={{ item }} follow=true
+ with_items: "{{ disks }}"
+ register: disks_stat
+
- name: wipe off filesystems from disks
- name: wipe off filesystems from disks
-
shell: "[ -b {{ item }} ] | /usr/sbin/wipefs --all --force {{ item }} || /usr/sbin/wipefs --all --force {{
item }}"
+
command: "/usr/sbin/wipefs --all --force {{ item.
item }}"
args:
creates: /etc/storage/osd_disk_metadata.json
args:
creates: /etc/storage/osd_disk_metadata.json
- with_items: "{{ disks }}"
+ with_items: "{{ disks_stat.results }}"
+ when: item.stat.exists and item.stat.isblk
- name: destroy data from disks
- name: destroy data from disks
-
shell: "[ -b {{ item }} ] | dd if=/dev/zero of={{
item }} count=200 bs=1M"
+
command: "dd if=/dev/zero of={{ item.
item }} count=200 bs=1M"
args:
creates: /etc/storage/osd_disk_metadata.json
args:
creates: /etc/storage/osd_disk_metadata.json
- with_items: "{{ disks }}"
+ with_items: "{{ disks_stat.results }}"
+ when: item.stat.exists and item.stat.isblk
- name: destroy partitions from disks
- name: destroy partitions from disks
-
shell: "[ -b {{ item }} ] | /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -- {{ item }} || /usr/sbin/sgdisk --zap-all --clear --mbrtogpt -- {{
item }}"
+
command: "/usr/sbin/sgdisk --zap-all --clear --mbrtogpt -- {{ item.
item }}"
args:
creates: /etc/storage/osd_disk_metadata.json
args:
creates: /etc/storage/osd_disk_metadata.json
- with_items: "{{ disks }}"
+ with_items: "{{ disks_stat.results }}"
+ when: item.stat.exists and item.stat.isblk