From 3e6df8c1f5cedbd427fd66389b5d39280d62576e Mon Sep 17 00:00:00 2001 From: David Galloway Date: Thu, 4 Aug 2016 21:33:05 -0400 Subject: [PATCH] testnode: Zap GPT and MBR on all disks but root Fixes: http://tracker.ceph.com/issues/15951 Signed-off-by: David Galloway --- roles/testnode/tasks/main.yml | 4 ++++ roles/testnode/tasks/zap_disks.yml | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 roles/testnode/tasks/zap_disks.yml diff --git a/roles/testnode/tasks/main.yml b/roles/testnode/tasks/main.yml index 033d386..a72a453 100644 --- a/roles/testnode/tasks/main.yml +++ b/roles/testnode/tasks/main.yml @@ -23,6 +23,10 @@ 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 index 0000000..8b7f1d8 --- /dev/null +++ b/roles/testnode/tasks/zap_disks.yml @@ -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 -- 2.39.5