From 4295d427b9b0905a3dbe06eaa4968baba4983a46 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Thu, 9 Feb 2017 10:54:49 +0100 Subject: [PATCH] Check if ceph_conf_overrides.global is defined before calling it Expand the fix in #1291 to all the playbook in order to get a full coverage. Fix: #1294 Signed-off-by: Guillaume Abrioux --- roles/ceph-client/tasks/main.yml | 1 + roles/ceph-client/tasks/pre_requisite.yml | 4 ++++ roles/ceph-mon/tasks/ceph_keys.yml | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/roles/ceph-client/tasks/main.yml b/roles/ceph-client/tasks/main.yml index b0ad7283d..36ec8a765 100644 --- a/roles/ceph-client/tasks/main.yml +++ b/roles/ceph-client/tasks/main.yml @@ -3,4 +3,5 @@ - include: create_users_keys.yml when: - user_config + - global_in_ceph_conf_overrides - ceph_conf_overrides.global.osd_pool_default_pg_num is defined diff --git a/roles/ceph-client/tasks/pre_requisite.yml b/roles/ceph-client/tasks/pre_requisite.yml index 43abd45f7..788df130c 100644 --- a/roles/ceph-client/tasks/pre_requisite.yml +++ b/roles/ceph-client/tasks/pre_requisite.yml @@ -7,3 +7,7 @@ group: "ceph" mode: "0600" when: cephx + +- name: check if global key exists in ceph_conf_overrides + set_fact: + global_in_ceph_conf_overrides: "{{ 'global' in ceph_conf_overrides }}" diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index 3986661a3..790838356 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -77,7 +77,9 @@ - set_fact: osd_pool_default_pg_num: "{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}" - when: ceph_conf_overrides.global.osd_pool_default_pg_num is defined + when: + - global_in_ceph_conf_overrides + - ceph_conf_overrides.global.osd_pool_default_pg_num is defined - name: test if rbd exists command: ceph --cluster {{ cluster }} osd pool stats rbd @@ -91,11 +93,13 @@ - include: rbd_pool_pgs.yml when: - rbd_pool_exist.rc == 0 + - global_in_ceph_conf_overrides - ceph_conf_overrides.global.osd_pool_default_pg_num is defined - include: rbd_pool_size.yml when: - rbd_pool_exist.rc == 0 + - global_in_ceph_conf_overrides - ceph_conf_overrides.global.osd_pool_default_size is defined - include: openstack_config.yml