blob: d92b37e89610cfe658a67ee7e5b15a3b2eeebb77 [file] [log] [blame]
{%- from "gnocchi/map.jinja" import cfg,server,statsd with context %}
{%- set storage = cfg.get('storage', {}) %}
{%- set _database = cfg.database %}
{%- set connection_x509_ssl_option = '' %}
{%- if _database.get('x509',{}).get('enabled',False) %}
{%- set connection_x509_ssl_option = '&ssl_ca=' ~ _database.x509.ca_file ~ '&ssl_cert=' ~ _database.x509.cert_file ~ '&ssl_key=' ~ _database.x509.key_file %}
{%- elif _database.get('ssl',{}).get('enabled',False) %}
{%- set connection_x509_ssl_option = '&ssl_ca=' ~ _database.ssl.get('cacert_file', cfg.cacert_file) %}
{%- endif %}
[DEFAULT]
debug = {{ cfg.debug }}
[api]
auth_mode = {{ server.identity.engine }}
{%- if server.get('api', {}).max_limit is defined %}
max_limit = {{ server.api.max_limit }}
{%- endif %}
{%- if server.get('api', {}).refresh_timeout is defined %}
refresh_timeout = {{ server.api.refresh_timeout }}
{%- endif %}
[archive_policy]
{%- if server.get('archive_policy', {}).default_aggregation_methods is defined %}
default_aggregation_methods = {{ ','.join(server.archive_policy.default_aggregation_methods) }}
{%- endif %}
[cors]
{%- if server.cors is defined %}
{%- if server.cors.allowed_origin is defined %}
allowed_origin = {{ server.cors.allowed_origin }}
{%- endif %}
{%- if server.cors.allow_credentials is defined %}
allow_credentials = {{ server.cors.allow_credentials }}
{%- endif %}
{%- if server.cors.expose_headers is defined %}
expose_headers = {{ server.cors.expose_headers }}
{%- endif %}
{%- if server.cors.max_age is defined %}
max_age = {{ server.cors.max_age }}
{%- endif %}
{%- if server.cors.allow_methods is defined %}
allow_methods = {{ server.cors.allow_methods }}
{%- endif %}
{%- if server.cors.allow_headers is defined %}
allow_headers = {{ server.cors.allow_headers }}
{%- endif %}
{%- endif %}
[incoming]
{%- set _storage = storage.get('incoming', {}) %}
{%- if _storage.driver is defined %}
driver = {{ _storage.driver }}
{% include "gnocchi/files/" + cfg.version|string + "/storage/_" + _storage.driver + ".conf" %}
{%- endif %}
[indexer]
url = {{ cfg.database.engine }}+pymysql://{{ cfg.database.user }}:{{ cfg.database.password }}@{{ cfg.database.host }}/{{ cfg.database.name }}?charset=utf8{{ connection_x509_ssl_option|string }}
[keystone_authtoken]
{%- if server.identity.engine == 'keystone' %}
user_domain_id = {{ server.identity.get('domain', 'default') }}
project_domain_id = {{ server.identity.get('domain', 'default') }}
project_name = {{ server.identity.tenant }}
username = {{ server.identity.user }}
password = {{ server.identity.password }}
auth_uri = {{ server.identity.get('protocol', 'http') }}://{{ server.identity.host }}:{{ server.identity.private_port }}
auth_url = {{ server.identity.protocol }}://{{ server.identity.host }}:{{ server.identity.port }}
{%- if server.identity.protocol == 'https' %}
cafile={{ server.identity.get('cacert_file', server.cacert_file) }}
{%- endif %}
{%- if server.identity.auth_type is defined %}
auth_type = {{ server.identity.auth_type }}
{%- endif %}
{%- endif %}
{%- if server.get('cache', {}).members is defined %}
memcached_servers={%- for member in server.cache.members %}{{ member.host }}:{{ member.port }}{% if not loop.last %},{% endif %}{%- endfor %}
{%- endif %}
{%- if server.get('cache', {}).token_cache_time is defined %}
token_cache_time = {{ server.cache.token_cache_time }}
{%- endif %}
{%- if server.cache.get('security', {}).get('enabled', False) %}
memcache_security_strategy = {{ server.cache.security.get('strategy', 'ENCRYPT') }}
{%- if server.cache.security.secret_key is not defined or not server.cache.security.secret_key %}
{%- do salt.test.exception('gnocchi.server.cache.security.secret_key is not defined: Please add secret_key') %}
{%- else %}
memcache_secret_key = {{ server.cache.security.secret_key }}
{%- endif %}
{%- endif %}
{%- if server.get('cache', {}).memcache_pool_dead_retry is defined %}
memcache_pool_dead_retry = {{ server.cache.memcache_pool_dead_retry }}
{%- endif %}
{%- if server.get('cache', {}).memcache_pool_maxsize is defined %}
memcache_pool_maxsize = {{ server.cache.memcache_pool_maxsize }}
{%- endif %}
{%- if server.get('cache', {}).memcache_pool_socket_timeout is defined %}
memcache_pool_socket_timeout = {{ server.cache.memcache_pool_socket_timeout }}
{%- endif %}
{%- if server.get('cache', {}).memcache_pool_unused_timeout is defined %}
memcache_pool_unused_timeout = {{ server.cache.memcache_pool_unused_timeout }}
{%- endif %}
{%- if server.get('cache', {}).memcache_pool_conn_get_timeout is defined %}
memcache_pool_conn_get_timeout = {{ server.cache.memcache_pool_conn_get_timeout }}
{%- endif %}
[metricd]
{%- if server.get('metricd', {}).workers is defined %}
workers = {{ server.metricd.workers }}
{%- endif %}
{%- if server.get('metricd', {}).metric_processing_delay is defined %}
metric_processing_delay = {{ server.metricd.metric_processing_delay }}
{%- endif %}
{%- if server.get('metricd', {}).metric_reporting_delay is defined %}
metric_reporting_delay = {{ server.metricd.metric_reporting_delay }}
{%- endif %}
{%- if server.get('metricd', {}).metric_cleanup_delay is defined %}
metric_cleanup_delay = {{ server.metricd.metric_cleanup_delay }}
{%- endif %}
{%- if server.get('metricd', {}).worker_sync_rate is defined %}
worker_sync_rate = {{ server.metricd.worker_sync_rate }}
{%- endif %}
{%- if server.get('metricd', {}).processing_replicas is defined %}
processing_replicas = {{ server.metricd.processing_replicas }}
{%- endif %}
[oslo_middleware]
{%- if server.enable_proxy_headers_parsing is defined %}
enable_proxy_headers_parsing = {{ server.enable_proxy_headers_parsing }}
{%- endif %}
[statsd]
{%- if statsd.get('bind', {}).address is defined %}
host = {{ statsd.bind.address }}
{%- endif %}
{%- if statsd.get('bind', {}).port is defined %}
port = {{ statsd.bind.port }}
{%- endif %}
{%- if statsd.get('enabled', False) %}
resource_id = {{ statsd.resource_id }}
{%- endif %}
{%- if statsd.user_id is defined and statsd.project_id is defined %}
creator = {{ statsd.user_id }}:{{ statsd.project_id }}
{%- endif %}
{%- if statsd.archive_policy_name is defined %}
archive_policy_name = {{ statsd.archive_policy_name }}
{%- endif %}
{%- if statsd.flush_delay is defined %}
flush_delay = {{ statsd.flush_delay }}
{%- endif %}
[storage]
{%- set _storage = storage %}
{%- if _storage.driver is defined %}
driver = {{ _storage.driver }}
{% include "gnocchi/files/" + cfg.version|string + "/storage/_" + _storage.driver + ".conf" %}
{%- endif %}
{%- if storage.aggregation_workers is defined %}
aggregation_workers_number = {{ storage.aggregation_workers }}
{%- endif %}
{%- if cfg.coordination_backend is defined %}
{%- if cfg.get('coordination_backend', {}).redis is defined and cfg.coordination_backend.get('engine', redis) == 'redis' %}
{%- set conn = cfg.coordination_backend.redis %}
{%- if conn.sentinel is defined %}
coordination_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.sentinel.host }}:{{ conn.sentinel.get('port', '26379') }}?sentinel={{ conn.sentinel.master_name }}{%
if conn.db is defined -%}&db={{ conn.db }}{% endif -%}{%
if conn.sentinel.fallback is defined %}{% for member in conn.sentinel.fallback -%}&sentinel_fallback={{ member.host }}:{{ member.get('port', '26379') }}{%- endfor -%}{% endif -%}
{%- else %}
coordination_url = {{ conn.get('scheme', 'redis') }}://{{ conn.user }}:{{ conn.password }}@{{ conn.host }}:{{ conn.get('port', '6379') }}{% if conn.db is defined -%}?db={{ conn.db }}{% endif -%}
{%- endif %}
{%- elif cfg.coordination_backend.url is defined %}
coordination_url = {{ cfg.coordination_backend.url }}
{%- endif %}
{%- endif %}
{%- if cfg.configmap is defined %}
{%- set _data = cfg.configmap %}
{%- include "oslo_templates/files/configmap/configmap.conf" %}
{%- endif %}