tripleo-ansible/tripleo_ansible/roles/tripleo-ceph-work-dir/tasks/build_pools.yml
Francesco Pantano 7940dd9143
Add default value in CinderRbdExtraPools task condition
If overrides is empty and CinderRbdExtraPools are specified
(with external ceph clusters), the task that is supposed to
build pools fail.
Adding a default value is safe and avoid this issue.

Change-Id: I7ab85b88f46bb29e4ca9d547ad1743e6e07b0afe
Closes-Bug: #1885258
(cherry picked from commit ea50aaff18)
2020-07-16 10:07:09 +02:00

92 lines
3.9 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 pool list
block:
- name: build filter list
set_fact:
overrides: "{{ overrides|default([]) + [ item.name ] }}"
with_items: "{{ ceph_pools.extra_pools }}"
- name: add images pool
set_fact:
images: [{'name': '{{ ceph_pools.glance_pool.name }}', 'pg_num': '{{ ceph_pools.pg_num }}', 'rule_name': 'replicated_rule', 'application': 'rbd'}]
when:
- tripleo_pool_images
- ceph_pools.glance_pool.name not in overrides|default([])
- name: add volumes pool
set_fact:
volumes: [{'name': '{{ ceph_pools.cinder_pool.name }}', 'pg_num': '{{ ceph_pools.pg_num }}', 'rule_name': 'replicated_rule', 'application': 'rbd'}]
when:
- tripleo_pool_volumes
- ceph_pools.cinder_pool.name not in overrides|default([])
- name: add vms pool
set_fact:
vms: [{'name': '{{ ceph_pools.nova_pool.name }}', 'pg_num': '{{ ceph_pools.pg_num }}', 'rule_name': 'replicated_rule', 'application': 'rbd'}]
when:
- tripleo_pool_vms
- ceph_pools.nova_pool.name not in overrides|default([])
- name: add gnocchi pool
set_fact:
metrics: [{'name': '{{ ceph_pools.gnocchi_pool.name }}', 'pg_num': '{{ ceph_pools.pg_num }}', 'rule_name': 'replicated_rule',
'application': 'openstack_gnocchi'}]
when:
- tripleo_pool_metrics
- tripleo_enabled_services | intersect(['gnocchi_api'])
- ceph_pools.gnocchi_pool.name not in overrides|default([])
- name: add cinder backup pool
set_fact:
backup: [{'name': '{{ ceph_pools.cinder_backup_pool.name }}', 'pg_num': '{{ ceph_pools.pg_num }}', 'rule_name': 'replicated_rule',
'application': 'rbd'}]
when:
- tripleo_pool_volumes
- tripleo_pool_backup
- tripleo_enabled_services | intersect(['cinder_backup'])
- ceph_pools.cinder_backup_pool.name not in overrides|default([])
- name: add cinder extra pools
set_fact:
cinder_extra: "{{ (cinder_extra|default([]) + [ pool ])|unique }}"
vars:
pool: "{'name': '{{ item }}', 'pg_num': '{{ ceph_pools.pg_num }}', 'rule_name': 'replicated_rule', 'application': 'rbd' }"
with_items: "{{ ceph_pools.cinder_pool.cinder_extra_pools }}"
when:
- tripleo_pool_volumes
- item not in overrides | default([])
- name: build resulting pool list
set_fact:
openstack_pools: "{'openstack_pools': {{ vms|default([]) + volumes|default([]) + images|default([]) + metrics|default([])
+ backup|default([]) + cinder_extra|default([]) + ceph_pools.extra_pools|default([]) }} }"
- name: build manila pool list
block:
- name: add manila data pool
set_fact:
cephfs_data: {'cephfs_data_pool': {'name': '{{ manila_pools.data }}', 'pg_num': '{{ manila_pools.data_pg_num }}',
'rule_name': 'replicated_rule', 'application': 'cephfs'}}
- name: add manila metadata pool
set_fact:
cephfs_metadata: {'cephfs_metadata_pool': {'name': '{{ manila_pools.metadata }}', 'pg_num': '{{ manila_pools.metadata_pg_num }}',
'rule_name': 'replicated_rule', 'application': 'cephfs'}}
when:
- tripleo_enabled_services | intersect(['manila_api'])