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-04-26 14:02:30 +02:00
|
|
|
{%- set sls_config_args = tplroot ~ '.config.args' %}
|
2019-04-24 18:18:44 +02:00
|
|
|
{%- set sls_config_file = tplroot ~ '.config.file' %}
|
|
|
|
{%- 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-08 19:39:21 +02:00
|
|
|
prometheus-service-running-service-unmasked:
|
|
|
|
service.unmasked:
|
|
|
|
- name: {{ prometheus.service.name }}
|
2019-06-16 02:33:24 +02:00
|
|
|
- onlyif: systemctl list-unit-files | grep {{ prometheus.service.name }} >/dev/null 2>&1
|
2019-06-08 19:39:21 +02:00
|
|
|
|
2019-04-24 18:18:44 +02:00
|
|
|
prometheus-service-running-service-running:
|
|
|
|
service.running:
|
|
|
|
- name: {{ prometheus.service.name }}
|
|
|
|
- enable: True
|
2019-06-08 19:39:21 +02:00
|
|
|
{%- if 'config' in prometheus and prometheus.config %}
|
2019-04-24 18:18:44 +02:00
|
|
|
- watch:
|
2019-06-08 19:39:21 +02:00
|
|
|
- file: prometheus-config-file-file-managed-config_file
|
2019-04-24 18:18:44 +02:00
|
|
|
- require:
|
2019-06-08 19:39:21 +02:00
|
|
|
- service: prometheus-service-running-service-unmasked
|
2019-04-26 14:02:30 +02:00
|
|
|
- sls: {{ sls_config_args }}
|
2019-04-24 18:18:44 +02:00
|
|
|
- sls: {{ sls_config_file }}
|
2019-06-08 19:39:21 +02:00
|
|
|
{%- endif %}
|
2019-06-16 02:33:24 +02:00
|
|
|
- onlyif: systemctl list-unit-files | grep {{ prometheus.service.name }} >/dev/null 2>&1
|