diff --git a/defaults/main.yml b/defaults/main.yml index 3758e51..1422761 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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: >- {{ diff --git a/releasenotes/notes/cloudkitty_storage_config-48e154cc2b549238.yaml b/releasenotes/notes/cloudkitty_storage_config-48e154cc2b549238.yaml new file mode 100644 index 0000000..c9ad1f3 --- /dev/null +++ b/releasenotes/notes/cloudkitty_storage_config-48e154cc2b549238.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added a variable ``cloudkitty_storage`` that allows to easily define + storage configuration options for Cloudkitty. diff --git a/templates/cloudkitty.conf.j2 b/templates/cloudkitty.conf.j2 index 646f7fc..b8b03c4 100644 --- a/templates/cloudkitty.conf.j2 +++ b/templates/cloudkitty.conf.j2 @@ -88,5 +88,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 %}