47 lines
1.8 KiB
Django/Jinja
47 lines
1.8 KiB
Django/Jinja
# -*- coding: utf-8 -*-
|
|
# vim: ft=jinja
|
|
|
|
{#- Get the `tplroot` from `tpldir` #}
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
{#- Start imports as #}
|
|
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
|
|
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
|
|
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %}
|
|
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
|
|
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %}
|
|
{#- focused defaults #}
|
|
{%- import_yaml tplroot ~ "/archive/defaults.yaml" as archive_defaults %}
|
|
{%- import_yaml tplroot ~ "/archive/defaults.yaml" as config_defaults %}
|
|
|
|
{%- set defaults = salt['grains.filter_by'](default_settings,
|
|
merge=salt['grains.filter_by'](archive_defaults,
|
|
merge=salt['grains.filter_by'](config_defaults,
|
|
merge=salt['grains.filter_by'](osfamilymap, grain='os_family',
|
|
merge=salt['grains.filter_by'](osmap, grain='os',
|
|
merge=salt['grains.filter_by'](osfingermap, grain='osfinger',
|
|
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
|
merge=salt['pillar.get']('prometheus:lookup', default={}),
|
|
base='prometheus'),
|
|
base='prometheus'),
|
|
base='prometheus'),
|
|
base='prometheus'),
|
|
base='prometheus'),
|
|
base='prometheus'),
|
|
base='prometheus')
|
|
%}
|
|
|
|
{#- Merge the prometheus pillar #}
|
|
{%- set prometheus = salt['pillar.get']('prometheus', default=defaults, merge=True) %}
|
|
|
|
{#- Contactenate arguments #}
|
|
{%- macro concat_args(args) %}
|
|
{%- set args = args|dictsort %}
|
|
{%- if args|length > 0 %}
|
|
{%- for k,v in args -%}
|
|
{%- if not k or not v %}{% continue %}{% endif -%}
|
|
--{{ k }}={{ v }}
|
|
{%- if not loop.last %} {% endif -%}
|
|
{%- endfor -%}
|
|
{%- endif -%}
|
|
{%- endmacro %}
|