131588559a
This change adds ceph config overrides support by
moving the logic from tht to tripleo-ansible.
This allow us to avoid centralizing all the
variables in ceph-base.yml, distributing them to
the related templates.
The logic implemented here just merge the provided
structures, maintaining backward compatibility with
the old used "key:value" pattern without a specific
section (which use global by default).
Closes-Bug: #1867006
Change-Id: Idbe0a6526fa262121bbb424f8705a3664ea00abd
(cherry picked from commit c5ecafbddc
)
44 lines
1.7 KiB
YAML
44 lines
1.7 KiB
YAML
---
|
|
# Copyright 2020 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
- name: build ceph orphan set
|
|
set_fact:
|
|
ceph_orphan: |-
|
|
{% set ceph_orphan = {} %}
|
|
{% for key, value in (ceph_config_overrides | default({})).items() %}
|
|
{% if not (['global', 'mon', 'mgr', 'osd', 'mds', 'client']) | intersect([key]) %}
|
|
{% set _ = ceph_orphan.__setitem__(key, value) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{{ ceph_orphan }}
|
|
|
|
- name: clean ceph_config_overrides list
|
|
set_fact:
|
|
config_overrides: "{{ config_overrides|default({})|combine({item.key: item.value}, recursive=True) }}"
|
|
when:
|
|
- not (ceph_orphan.keys() | intersect([item.key]))
|
|
with_dict: "{{ ceph_config_overrides|default({}) }}"
|
|
|
|
- name: ceph_config_overrides w/o orphans
|
|
set_fact:
|
|
ceph_orphan: "{{ {'global': ceph_orphan|default({}) } }}"
|
|
when: ceph_orphan.keys() | length > 0
|
|
|
|
- name: build ceph config overrides
|
|
set_fact:
|
|
ceph_overrides: "{'ceph_conf_overrides': {{ ceph_default_overrides|default({}) |combine(config_overrides|default({}), recursive=True)
|
|
|combine(ceph_rgw_config_overrides|default({}), recursive=True)|combine(ceph_orphan|default({}), recursive=True)}} }"
|