3a82ac8bf0
Change-Id: Icef4e4aaaadffbd9db81c32108e13d58051106f4
33 lines
1.4 KiB
YAML
33 lines
1.4 KiB
YAML
{%- if pillar.grafana.collector is defined %}
|
|
{%- 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 %}
|