]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
testnode: Zap GPT and MBR on all disks but root
authorDavid Galloway <dgallowa@redhat.com>
Fri, 5 Aug 2016 01:33:05 +0000 (21:33 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Thu, 17 Nov 2016 20:34:12 +0000 (15:34 -0500)
Fixes: http://tracker.ceph.com/issues/15951
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/testnode/tasks/main.yml
roles/testnode/tasks/zap_disks.yml [new file with mode: 0644]

index 033d386763d4c76a7bb2e593480e33da31c8b5d5..a72a45381fc2d1535bfa449ce35e0d46eba46e14 100644 (file)
   tags:
     - hostname
 
+- include: zap_disks.yml
+  tags:
+    - zap
+
 # partition drives, if any are requested
 - include: drive_partitioning.yml
   when: drive_to_partition is defined
diff --git a/roles/testnode/tasks/zap_disks.yml b/roles/testnode/tasks/zap_disks.yml
new file mode 100644 (file)
index 0000000..8b7f1d8
--- /dev/null
@@ -0,0 +1,16 @@
+---
+- name: Make sure gdisk is installed
+  package:
+    name: gdisk
+    state: present
+
+- name: Set root disk
+  set_fact:
+    root_disk: "{{ item.device|regex_replace('[0-9]+', '') }}"
+  with_items: "{{ ansible_mounts }}"
+  when: item.mount == '/'
+
+- name: Zap all non-root disks
+  command: sgdisk --zap-all "/dev/{{ item.key }}"
+  with_dict: "{{ ansible_devices }}"
+  when: item.key not in root_disk