Add variable to configure storage options

With addition of storage v2 versions and v2 API it's now less trivial
to rely on overrides for storage configuration, which most likely will be
needed regardless, since v1 storages are incompatible with /v2 API,
and latter one gets disabled whenever v1 storage is in use.

With that there's no dummy storage in /v2 for testing purposes, so
we are not able to have any reasonable default out of the box.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/920058
Change-Id: Ic0d055c98ee6e35fb28b26de8cf3d20e7e79ad87
This commit is contained in:
Dmitriy Rabotyagov 2024-03-08 18:36:39 +01:00 committed by Jonathan Rosser
parent 744c46f6cd
commit 7ee5018dfc
3 changed files with 28 additions and 2 deletions

View File

@ -117,6 +117,20 @@ cloudkitty_output_backend: cloudkitty.backend.file.FileBackend
cloudkitty_output_pipeline: osrf
cloudkitty_output_basepath: /var/cloudkitty/reports
# Please define a storage for CloudKitty data in as a nested dictionary.
# Keys `backend` and `version` are required. `config` contains extra
# configuration for the storage backend when applicable.
# For example:
# cloudkitty_storage:
# backend: opensearch
# version: 2
# config:
# host = http://localhost:9200
# index_name = cloudkitty
cloudkitty_storage:
backend: sqlalchemy
version: 1
cloudkitty_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
cloudkitty_db_setup_python_interpreter: >-
{{

View File

@ -0,0 +1,5 @@
---
features:
- |
Added a variable ``cloudkitty_storage`` that allows to easily define
storage configuration options for Cloudkitty.

View File

@ -77,5 +77,12 @@ backend = {{ cloudkitty_output_backend }}
[state]
[storage]
backend = sqlalchemy
version = 1
backend = {{ cloudkitty_storage['backend'] }}
version = {{ cloudkitty_storage['version'] }}
{% if 'config' in cloudkitty_storage %}
[storage_{{ cloudkitty_storage['backend'] }}]
{% for item, value in cloudkitty_storage['config'].items() %}
{{ item }} = {{ value }}
{% endfor %}
{% endif %}