merge defaults with pillar

This commit is contained in:
m0duspwnens
2022-12-19 15:55:35 -05:00
parent 30419e5b2b
commit 6a4718ec0f
2 changed files with 10 additions and 10 deletions

View File

@@ -1,12 +1,13 @@
{%- import_yaml 'influxdb/defaults.yaml' as influx %}
{%- import_yaml 'influxdb/defaults.yaml' as INFLUXDEFAULTS %}
{%- set INFLUXMERGED = salt['pillar.get']('influxdb', default=INFLUXDEFAULTS.influxdb, merge=true) %}
{%- for header in influx.influxdb.config.keys() %}
{%- for header in INFLUXMERGED.config.keys() %}
{%- if header in ['graphite', 'collectd', 'opentsdb', 'udp'] %}
[[{{header}}]]
{%- else %}
[{{header}}]
{%- endif %}
{%- for k, v in influx.influxdb.config[header].items() %}
{%- for k, v in INFLUXMERGED.config[header].items() %}
{#- is v a list? #}
{%- if v is iterable and (v is not string and v is not mapping) %}
{{k}} = [
@@ -14,14 +15,12 @@
"{{li}}",
{%- endfor %}
]
{%- else %}
{%- if v is string %}
{%- elif v is string %}
{{k}} = "{{v}}"
{%- elif v is boolean %}
{{k}} = {{v|string|lower}}
{%- else %}
{{k}} = {{v}}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- endfor %}

View File

@@ -1,6 +1,7 @@
{% import_yaml 'redis/defaults.yaml' as redis %}
{%- import_yaml 'redis/defaults.yaml' as REDISDEFAULTS %}
{%- set REDISMERGED = salt['pillar.get']('redis', default=REDISDEFAULTS.redis, merge=true) %}
{%- for k, v in redis.redis.config.items() %}
{%- for k, v in REDISMERGED.config.items() %}
{%- if v is iterable and v is not string %}
{%- for v1, v2 in v.items() %}
{{k}} {{v1}} {{v2}}