From 6a4718ec0f87a53f02ea7572fff79e789f32baad Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Mon, 19 Dec 2022 15:55:35 -0500 Subject: [PATCH] merge defaults with pillar --- salt/influxdb/etc/influxdb.conf.jinja | 15 +++++++-------- salt/redis/etc/redis.conf.jinja | 5 +++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/salt/influxdb/etc/influxdb.conf.jinja b/salt/influxdb/etc/influxdb.conf.jinja index 0c4d93eae..ce607292d 100644 --- a/salt/influxdb/etc/influxdb.conf.jinja +++ b/salt/influxdb/etc/influxdb.conf.jinja @@ -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 %} +{%- elif v is boolean %} {{k}} = {{v|string|lower}} -{%- else %} +{%- else %} {{k}} = {{v}} -{%- endif %} {%- endif %} {%- endfor %} {%- endfor %} diff --git a/salt/redis/etc/redis.conf.jinja b/salt/redis/etc/redis.conf.jinja index 3fa6e4388..c3291c3e8 100644 --- a/salt/redis/etc/redis.conf.jinja +++ b/salt/redis/etc/redis.conf.jinja @@ -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}}