formula-prometheus/prometheus/meta/salt.yml
Olivier Bourdon 31bfa9d94c Fix exporters configuration to be generic
Change-Id: If5cf3662f96311a5f37055c0f62934ba5407a978
2017-07-11 16:07:45 +02:00

21 lines
984 B
Django/Jinja

grain:
{%- if pillar.get('prometheus', {}).get('collector') %}
{%- from "prometheus/map.jinja" import exporters,server as prometheus_server with context %}
prometheus:
{%- set service_grains = {'prometheus': {'server': {'alert': {}, 'recording': {}, 'target': {}}}} %}
{%- for service_name, service in pillar.items() %}
{%- if service.get('_support', {}).get('prometheus', {}).get('enabled', False) %}
{%- set grains_fragment_file = service_name+'/meta/prometheus.yml' %}
{%- macro load_grains_file() %}{% include grains_fragment_file ignore missing %}{% endmacro %}
{%- set grains_yaml = load_grains_file()|load_yaml %}
{%- if grains_yaml is mapping %}
{%- set service_grains = salt['grains.filter_by']({'default': service_grains}, merge={'prometheus': grains_yaml}) %}
{%- endif %}
{%- endif %}
{%- endfor %}
{{ service_grains|yaml(False)|indent(4) }}
{%- endif %}
{#-
vim: syntax=jinja
-#}