1
0
Fork 0
mirror of synced 2024-11-05 09:18:57 -05:00
formula-grafana/grafana/meta/salt.yml
Tomáš Kukrál 2127f4e493 fix meta/salt with missing pillar
Change-Id: I714a6ecfe3d4e3014d31bf4009dd3e6fc46bc86e
2017-05-11 20:17:38 +00:00

33 lines
1.4 KiB
YAML

{%- if pillar.get('grafana', {}).get('collector') %}
{%- if pillar.grafana.collector.get('enabled', False) %}
{%- set service_grains = {} %}
{%- for service_name, service in pillar.iteritems() %}
{%- if service.get('_support', {}).get('grafana', {}).get('enabled', False) %}
{%- macro load_grains_file(grains_fragment_file) %}{% include grains_fragment_file ignore missing %}{% endmacro %}
{%- set grains_fragment_file = service_name+'/meta/grafana.yml' %}
{%- set grains_yaml = load_grains_file(grains_fragment_file)|load_yaml %}
{%- set service_grains = salt['grains.filter_by']({'default': service_grains}, merge=grains_yaml) %}
{%- endif %}
{%- endfor %}
grain:
grafana:
grafana:
{{ service_grains|yaml(False)|indent(6) }}
{%- endif %}
{%- endif %}
minion:
{%- if pillar.grafana.client is defined %}
grafana:
{%- from "grafana/map.jinja" import client with context %}
grafana_version: {{ client.server.get('version', 3) }}
grafana:
grafana_timeout: 3
{%- if client.server.token is defined %}
grafana_token: {{ client.server.token }}
{%- else %}
grafana_user: {{ client.server.user }}
grafana_password: {{ client.server.password }}
{%- endif %}
grafana_url: '{{ client.server.get('protocol', 'http') }}://{{ client.server.host }}:{{ client.server.get('port', 80) }}'
{%- endif %}