From 517a2b3febd47763f9c07a944a2a5cd182d915f4 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 26 Oct 2017 19:05:52 -0400 Subject: [PATCH] ceph-osd skip lvm creation if they are already in use Signed-off-by: Alfredo Deza --- roles/ceph-osd/tasks/scenarios/lvm.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roles/ceph-osd/tasks/scenarios/lvm.yml b/roles/ceph-osd/tasks/scenarios/lvm.yml index 856dcc5f4..d488ae6bb 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm.yml @@ -1,4 +1,12 @@ --- + +- name: list all lvm osds + command: ceph-volume lvm list + register: ceph_volume_lvm_list + failed_when: False + changed_when: False + check_mode: no + - name: use ceph-volume to create filestore osds with dedicated journals command: "ceph-volume --cluster {{ cluster }} lvm create --filestore --data {{ item.data_vg }}/{{ item.data }} --journal {{ item.journal }}" environment: @@ -7,6 +15,7 @@ when: - item.journal_vg is not defined - osd_objectstore == 'filestore' + - "'{{ item.data_vg }}/{{ item.data }}' not in ceph_volume_lvm_list.stdout" - name: use ceph-volume to create filestore osds with dedicated lv journals command: "ceph-volume --cluster {{ cluster }} lvm create --filestore --data {{ item.data_vg }}/{{ item.data }} --journal {{item.journal_vg }}/{{ item.journal }}" @@ -16,6 +25,7 @@ when: - item.journal_vg is defined - osd_objectstore == 'filestore' + - "'{{ item.data_vg }}/{{ item.data }}' not in ceph_volume_lvm_list.stdout" - name: use ceph-volume to create bluestore osds with db and wal command: "ceph-volume --cluster {{ cluster }} lvm create --bluestore --data {{ item.data_vg }}/{{ item.data }} --block.wal {{ item.wal_vg }}/{{ item.wal }} --block.db {{ item.db_vg }}/{{ item.db }}" @@ -28,6 +38,7 @@ - item.wal_vg is defined - item.db is defined - item.db_vg is defined + - "'{{ item.data_vg }}/{{ item.data }}' not in ceph_volume_lvm_list.stdout" - name: use ceph-volume to create bluestore osds with db only command: "ceph-volume --cluster {{ cluster }} lvm create --bluestore --data {{ item.data_vg }}/{{ item.data }} --block.db {{ item.db_vg }}/{{ item.db }}" @@ -40,6 +51,7 @@ - item.wal_vg is not defined - item.db is defined - item.db_vg is defined + - "'{{ item.data_vg }}/{{ item.data }}' not in ceph_volume_lvm_list.stdout" - name: use ceph-volume to create bluestore osds with wal only command: "ceph-volume --cluster {{ cluster }} lvm create --bluestore --data {{ item.data_vg }}/{{ item.data }} --block.wal {{ item.wal_vg }}/{{ item.wal }}" @@ -52,6 +64,7 @@ - item.wal_vg is defined - item.db is not defined - item.db_vg is not defined + - "'{{ item.data_vg }}/{{ item.data }}' not in ceph_volume_lvm_list.stdout" - name: use ceph-volume to create bluestore osds with just a data device command: "ceph-volume --cluster {{ cluster }} lvm create --bluestore --data {{ item.data_vg }}/{{ item.data }}" @@ -64,3 +77,4 @@ - item.wal_vg is not defined - item.db is not defined - item.db_vg is not defined + - "'{{ item.data_vg }}/{{ item.data }}' not in ceph_volume_lvm_list.stdout"