c9af93ce61
When including /meta/salt.yml from outside of this formula the yaml can fail if appropriate pillar elements are not found. Changing syntax to eliminate this. Including the file above is needed for generating minion orchestration config for future use with salt orchestration methods Change-Id: Ia3fb7eee7c6298d294f641232c8c7e8f8b5806af Related-PROD: PROD-19973
33 lines
1.4 KiB
YAML
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.get('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 %}
|