formula-prometheus/prometheus/meta/salt.yml
Tomáš Kukrál 3d960a15b4
fix meta/salt with missing pillar
Change-Id: I43333c76bb3814d2c6b98849df109ef97523dc7e
2017-05-11 22:06:19 +02:00

21 lines
974 B
Django/Jinja

grain:
{%- if pillar.get('prometheus', {}).get('collector') %}
{%- from "prometheus/map.jinja" import 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
-#}