prometheus-formula/prometheus/service/args/clean.sls
N ce5b7712c9 refactor(all): align to template-formula; add clientlibs feature
BREAKING CHANGE: The data dictionary is simplified and expanded.
Retest your states and update pillar data accordingly.
For developer convenience, clientlibs states were introduced.
See pillar.example, defaults.yaml, and docs/README.
2020-05-15 11:12:28 +01:00

39 lines
1.1 KiB
Plaintext

# -*- coding: utf-8 -*-
# vim: ft=sls
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
include:
- {{ sls_service_clean }}
{%- for name in p.wanted.component %}
{%- if 'service' in p.pkg.component[name] and p.pkg.component[name]['service'] %}
prometheus-service-args-clean-{{ name }}:
file.absent:
- names:
- /tmp/dummy-{{ name }}-dummy
{%- if 'storage.tsdb.path' in p.pkg.component[name]['service']['args'] %}
- {{ p.pkg.component[name]['service']['args']['storage.tsdb.path'] }}
{%- endif %}
- require:
- sls: {{ sls_service_clean }}
{%- if grains.os_family == 'FreeBSD' %}
sysrc.absent:
- names:
- {{ name }}_args
- {{ name }}_listen_address
- {{ name }}_textfile_dir
- {{ name }}_data_dir
- {{ name }}_config
- require:
- sls: {{ sls_service_clean }}
{%- endif %}
{%- endif %}
{%- endfor %}