# -*- coding: utf-8 -*- # vim: ft=sls {#- Get the `tplroot` from `tpldir` #} {%- set tplroot = tpldir.split('/')[0] %} {%- set sls_config_args = tplroot ~ '.config.args' %} {%- set sls_config_file = tplroot ~ '.config.file' %} {%- from tplroot ~ "/map.jinja" import prometheus with context %} include: - {{ sls_config_args }} - {{ sls_config_file }} prometheus-config-file-var-file-directory: file.directory: - name: {{ prometheus.dir.var }} - user: prometheus - group: prometheus - mode: 755 - makedirs: True - require: - file: prometheus-config-file-etc-file-directory {%- for name in prometheus.wanted %} {%- if name in prometheus.service %} prometheus-service-running-{{ name }}-service-unmasked: service.unmasked: - name: {{ name }} - require: - file: prometheus-config-file-var-file-directory {%- if grains.kernel|lower == 'linux' %} - onlyif: - systemctl list-unit-files | grep {{ name }} >/dev/null 2>&1 {%- endif %} prometheus-service-running-{{ name }}-service-running: service.running: - name: {{ name }} - enable: True {%- if name in prometheus.config %} - watch: - file: prometheus-config-file-{{ name }}-file-managed {%- endif %} - require: - service: prometheus-service-running-{{ name }}-service-unmasked - file: prometheus-config-file-var-file-directory {%- if grains.kernel|lower == 'linux' %} - onlyif: systemctl list-unit-files | grep {{ name }} >/dev/null 2>&1 {%- endif %} {%- endif %} {%- endfor %}