From 40ec00d7f4c0aa271f4f09ae7dbf0abb4f46ea9a Mon Sep 17 00:00:00 2001 From: leseb Date: Mon, 6 Jul 2015 18:53:31 +0200 Subject: [PATCH] Make zap option more secure Prior to this change, the zap was executed during every play, this was not ideal. Now we do check if there is a 'ceph' partition. If so we skip the zap. Signed-off-by: leseb --- roles/ceph-osd/tasks/journal_collocation.yml | 2 +- roles/ceph-osd/tasks/raw_multi_journal.yml | 2 +- roles/ceph-osd/tasks/zap_devices.yml | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/roles/ceph-osd/tasks/journal_collocation.yml b/roles/ceph-osd/tasks/journal_collocation.yml index 613715eea..394e49ecb 100644 --- a/roles/ceph-osd/tasks/journal_collocation.yml +++ b/roles/ceph-osd/tasks/journal_collocation.yml @@ -1,8 +1,8 @@ --- ## SCENARIO 1: JOURNAL AND OSD_DATA ON THE SAME DEVICE -- include: zap_devices.yml - include: check_devices.yml +- include: zap_devices.yml # NOTE (leseb): the prepare process must be parallelized somehow... # if you have 64 disks with 4TB each, this will take a while diff --git a/roles/ceph-osd/tasks/raw_multi_journal.yml b/roles/ceph-osd/tasks/raw_multi_journal.yml index 76b7f0ff0..c85a04108 100644 --- a/roles/ceph-osd/tasks/raw_multi_journal.yml +++ b/roles/ceph-osd/tasks/raw_multi_journal.yml @@ -1,8 +1,8 @@ --- ## SCENARIO 3: N JOURNAL DEVICES FOR N OSDS -- include: zap_devices.yml - include: check_devices.yml +- include: zap_devices.yml # NOTE (leseb): the prepare process must be parallelized somehow... # if you have 64 disks with 4TB each, this will take a while diff --git a/roles/ceph-osd/tasks/zap_devices.yml b/roles/ceph-osd/tasks/zap_devices.yml index 9180daa09..afe5a365d 100644 --- a/roles/ceph-osd/tasks/zap_devices.yml +++ b/roles/ceph-osd/tasks/zap_devices.yml @@ -3,17 +3,27 @@ # in ceph-disk failing to prepare OSD. Thus zapping them prior to prepare the OSD # ensures that the device will get successfully prepared. - name: erasing partitions and labels from OSD disk(s) - command: ceph-disk zap {{ item }} - with_items: devices + command: ceph-disk zap {{ item.2 }} changed_when: false + with_together: + - parted.results + - ispartition.results + - devices when: + item.0.rc != 0 and + item.1.rc != 0 and zap_devices and (journal_collocation or raw_multi_journal) - name: erasing partitions and labels from the journal device(s) - command: ceph-disk zap {{ item }} - with_items: raw_journal_devices + command: ceph-disk zap {{ item.2 }} changed_when: false + with_together: + - parted.results + - ispartition.results + - raw_journal_devices when: + item.0.rc != 0 and + item.1.rc != 0 and zap_devices and raw_multi_journal -- 2.47.3