2019-04-24 18:18:44 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=sls
|
|
|
|
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
2019-04-24 18:18:44 +02:00
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- for name in p.wanted.component %}
|
|
|
|
{%- if 'service' in p.pkg.component[name] and p.pkg.component[name]['service'] %}
|
|
|
|
{%- set service_name = p.pkg.component[name]['service']['get'](name, {}).get('name', name) %}
|
2019-06-20 02:36:58 +02:00
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
prometheus-service-clean-{{ name }}:
|
2019-04-24 18:18:44 +02:00
|
|
|
service.dead:
|
2020-05-14 01:27:23 +02:00
|
|
|
- name: {{ service_name }}
|
2019-04-24 18:18:44 +02:00
|
|
|
- enable: False
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- if grains.kernel|lower == 'linux' %}
|
2019-10-04 12:13:24 +02:00
|
|
|
- onlyif: systemctl list-units | grep {{ service_name }} >/dev/null 2>&1
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- endif %}
|
2019-06-23 15:04:48 +02:00
|
|
|
file.absent:
|
2020-10-19 14:57:29 +02:00
|
|
|
- name: {{ p.dir.service }}{{ p.div }}{{ name }}.service
|
2019-06-23 15:04:48 +02:00
|
|
|
- require:
|
2020-05-14 01:27:23 +02:00
|
|
|
- service: prometheus-service-clean-{{ name }}
|
2019-06-23 15:04:48 +02:00
|
|
|
cmd.run:
|
|
|
|
- onlyif: {{ grains.kernel|lower == 'linux' }}
|
|
|
|
- name: systemctl daemon-reload
|
|
|
|
- require:
|
2020-05-14 01:27:23 +02:00
|
|
|
- file: prometheus-service-clean-{{ name }}
|
|
|
|
|
|
|
|
{%- if grains.os_family == 'FreeBSD' %}
|
|
|
|
sysrc.absent:
|
|
|
|
- name: {{ name }}_environ
|
|
|
|
- require:
|
|
|
|
- service: prometheus-service-clean-{{ name }}
|
2019-06-20 02:36:58 +02:00
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- endif %}
|
2019-06-20 02:36:58 +02:00
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|