Handle when ceph_osds is a dictionary or a list.

The ceph_osds variable is obtained from the ceph configuration
and it seems it can be a dictionary formed by the osds directories
as keys, example {'/dev/vdc': {}, '/dev/vdb': {}, '/dev/vdf': {},
'/dev/vde': {}, '/dev/vdd': {}} .
For that reason, we need to differentiate when the variable is
a list or a dictionary, as otherwise the loop variable won't be
able to iterate over the values.

Change-Id: Ib7aded0ff3668079dbe43cc3fbfa6a7e067cec83
Closes-Bug: #1844974
This commit is contained in:
Jose Luis Franco Arza 2019-09-23 10:10:49 +02:00
parent db990c03e9
commit 75290252d7
1 changed files with 2 additions and 1 deletions

View File

@ -42,8 +42,9 @@
- name: set ceph_osds fact
vars:
ceph_yaml: "{{ (ceph_puppet.stdout | from_yaml).parameter_defaults }}"
ceph_osds_var: "{{ ceph_yaml.ExtraConfig['ceph::profile::params::osds']}}"
set_fact:
ceph_osds: "{{ ceph_yaml.ExtraConfig['ceph::profile::params::osds'] | default([]) }}"
ceph_osds: "{{ (ceph_osds_var.keys()|list if ceph_osds_var | type_debug == 'dict' else ceph_osds_var) | default([]) }}"
- name: set ceph_osds_pg fact
vars: