2019-04-24 18:18:44 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=sls
|
|
|
|
|
|
|
|
{#- Get the `tplroot` from `tpldir` #}
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
2019-06-22 19:24:19 +02:00
|
|
|
{%- set sls_config_args = tplroot ~ '.config.args' %}
|
|
|
|
{%- set sls_config_file = tplroot ~ '.config.file' %}
|
2019-04-24 18:18:44 +02:00
|
|
|
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
|
|
|
|
|
|
include:
|
2019-04-26 14:02:30 +02:00
|
|
|
- {{ sls_config_args }}
|
2019-04-24 18:18:44 +02:00
|
|
|
- {{ sls_config_file }}
|
|
|
|
|
2019-06-22 19:24:19 +02:00
|
|
|
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
|
|
|
|
|
2019-06-20 02:36:58 +02:00
|
|
|
{%- for name in prometheus.wanted %}
|
|
|
|
{%- if name in prometheus.service %}
|
|
|
|
|
|
|
|
prometheus-service-running-{{ name }}-service-unmasked:
|
2019-06-08 19:39:21 +02:00
|
|
|
service.unmasked:
|
2019-06-20 02:36:58 +02:00
|
|
|
- name: {{ name }}
|
|
|
|
- require:
|
2019-06-22 19:24:19 +02:00
|
|
|
- file: prometheus-config-file-var-file-directory
|
2019-06-20 02:36:58 +02:00
|
|
|
{%- if grains.kernel|lower == 'linux' %}
|
|
|
|
- onlyif:
|
|
|
|
- systemctl list-unit-files | grep {{ name }} >/dev/null 2>&1
|
|
|
|
{%- endif %}
|
2019-06-08 19:39:21 +02:00
|
|
|
|
2019-06-20 02:36:58 +02:00
|
|
|
prometheus-service-running-{{ name }}-service-running:
|
2019-04-24 18:18:44 +02:00
|
|
|
service.running:
|
2019-06-20 02:36:58 +02:00
|
|
|
- name: {{ name }}
|
2019-04-24 18:18:44 +02:00
|
|
|
- enable: True
|
2019-06-20 02:36:58 +02:00
|
|
|
{%- if name in prometheus.config %}
|
2019-04-24 18:18:44 +02:00
|
|
|
- watch:
|
2019-06-20 02:36:58 +02:00
|
|
|
- file: prometheus-config-file-{{ name }}-file-managed
|
|
|
|
{%- endif %}
|
2019-04-24 18:18:44 +02:00
|
|
|
- require:
|
2019-06-20 02:36:58 +02:00
|
|
|
- service: prometheus-service-running-{{ name }}-service-unmasked
|
2019-06-22 19:24:19 +02:00
|
|
|
- file: prometheus-config-file-var-file-directory
|
2019-06-20 02:36:58 +02:00
|
|
|
{%- if grains.kernel|lower == 'linux' %}
|
|
|
|
- onlyif: systemctl list-unit-files | grep {{ name }} >/dev/null 2>&1
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|
|
|
|
|