1
0
Fork 0
mirror of synced 2024-11-16 22:25:34 -05:00
formula-grafana/grafana/meta/salt.yml

34 lines
1.4 KiB
YAML
Raw Normal View History

{%- 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 %}