diff --git a/salt/telegraf/config.map.jinja b/salt/telegraf/config.map.jinja new file mode 100644 index 000000000..4ac4597a4 --- /dev/null +++ b/salt/telegraf/config.map.jinja @@ -0,0 +1,3 @@ +{% import_yaml 'telegraf/defaults.yaml' as TGDEFAULTS %} + +{% set TGMERGED = salt['pillar.get']('telegraf', TGDEFAULTS.telegraf, merge=True) %} diff --git a/salt/telegraf/etc/telegraf.conf b/salt/telegraf/etc/telegraf.conf index a2f2b7f5b..895a25d6c 100644 --- a/salt/telegraf/etc/telegraf.conf +++ b/salt/telegraf/etc/telegraf.conf @@ -1,5 +1,4 @@ # Telegraf Configuration -{% import_yaml 'telegraf/defaults.yaml' as TGDEFAULTS %} {%- set MANAGER = GLOBALS.manager %} {%- set ES_USER = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:user', '') %} {%- set ES_PASS = salt['pillar.get']('elasticsearch:auth:users:so_elastic_user:pass', '') %} @@ -7,7 +6,6 @@ {%- set UNIQUEID = salt['pillar.get']('sensor:uniqueid', '') %} {%- set ZEEK_ENABLED = salt['pillar.get']('zeek:enabled', True) %} {%- set MDENGINE = GLOBALS.md_engine %} -{%- set TGMERGED = salt['pillar.get']('telegraf', TGDEFAULTS.telegraf, merge=true) %} # Global tags can be specified here in key="value" format. [global_tags] role = "{{ GLOBALS.role.split('-') | last }}" diff --git a/salt/telegraf/init.sls b/salt/telegraf/init.sls index b24602639..df5e78f32 100644 --- a/salt/telegraf/init.sls +++ b/salt/telegraf/init.sls @@ -1,7 +1,7 @@ {% from 'allowed_states.map.jinja' import allowed_states %} {% if sls in allowed_states %} - {% from 'vars/globals.map.jinja' import GLOBALS %} +{% from 'telegraf/config.map.jinja' import TGMERGED %} include: - ssl @@ -50,6 +50,7 @@ tgrafconf: - show_changes: False - defaults: GLOBALS: {{ GLOBALS }} + TGMERGED: {{ TGMERGED }} # this file will be read by telegraf to send node details (management interface, monitor interface, etc) # into influx so that Grafana can build dashboards using queries