fix(service): ensure service file is removed on clean
This commit is contained in:
parent
149dd817f2
commit
c735a6deea
@ -13,7 +13,7 @@ prometheus-formula
|
||||
:alt: Semantic Release
|
||||
:scale: 100%
|
||||
:target: https://github.com/semantic-release/semantic-release
|
||||
Manage Prometheus.
|
||||
Manage Prometheus on MacOS, GNU/Linux and FreeBSD.
|
||||
|
||||
.. contents:: **Table of Contents**
|
||||
|
||||
|
@ -14,14 +14,16 @@ include:
|
||||
|
||||
{%- for name in p.wanted %}
|
||||
{%- set bundle = name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) %}
|
||||
{%- if grains.os_family == 'Suse' %}
|
||||
|
||||
prometheus-archive-alternatives-install-{{ name }}-home-cmd-run:
|
||||
cmd.run:
|
||||
- onlyif: {{ grains.os_family in ('Suse',) }}
|
||||
- name: update-alternatives --install {{ p.dir.basedir }}/{{ bundle }} prometheus-{{ name }}-home {{ p.dir.basedir }}/{{ bundle }} {{p.linux.altpriority}}
|
||||
- watch:
|
||||
- archive: prometheus-archive-install-{{ name }}-archive-extracted
|
||||
|
||||
{%- else %}
|
||||
|
||||
prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install:
|
||||
alternatives.install:
|
||||
- name: prometheus-{{ name }}-home
|
||||
@ -40,8 +42,8 @@ prometheus-archive-alternatives-install-{{ name }}-home-alternatives-set:
|
||||
- require:
|
||||
- cmd: prometheus-archive-alternatives-install-{{ name }}-home-cmd-run
|
||||
- alternatives: prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install
|
||||
- onlyif: {{ grains.os_family not in ('Suse',) }}
|
||||
|
||||
{%- endif %}
|
||||
{% for b in p.pkg[name]['binaries'] %}
|
||||
|
||||
prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}:
|
||||
|
@ -6,9 +6,11 @@
|
||||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||
{%- set sls_alternatives_clean = tplroot ~ '.archive.alternatives.clean' %}
|
||||
{%- set sls_users_clean = tplroot ~ '.config.users.clean' %}
|
||||
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
||||
|
||||
include:
|
||||
- {{ sls_users_clean }}
|
||||
- {{ sls_service_clean }}
|
||||
- {{ sls_alternatives_clean }}
|
||||
|
||||
{%- for name in p.wanted %}
|
||||
@ -31,4 +33,3 @@ prometheus-archive-clean-{{ name }}-user-absent:
|
||||
prometheus-archive-clean-basedir-file-directory:
|
||||
file.absent:
|
||||
- name: {{ p.dir.basedir }}
|
||||
|
||||
|
@ -53,6 +53,8 @@ prometheus-archive-install-{{ name }}-file-directory:
|
||||
- archive: prometheus-archive-install-{{ name }}-archive-extracted
|
||||
- file: prometheus-config-file-basedir-file-directory
|
||||
|
||||
{%- if grains.os_family not in ('MacOS', 'FreeBSD', 'Windows') %}
|
||||
|
||||
prometheus-archive-install-{{ name }}-managed-service:
|
||||
file.managed:
|
||||
- name: {{ p.dir.service }}/{{ name }}.service
|
||||
@ -83,4 +85,5 @@ prometheus-archive-install-{{ name }}-managed-service:
|
||||
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
@ -10,6 +10,9 @@
|
||||
prometheus-config-user-clean-{{ name }}-user-absent:
|
||||
user.absent:
|
||||
- name: {{ name }}
|
||||
{%- if grains.os_family == 'MacOS' %}
|
||||
- onlyif: /usr/bin/dscl . list /Users | grep {{ name }} >/dev/null 2>&1
|
||||
{%- endif %}
|
||||
group.absent:
|
||||
- name: {{ name }}
|
||||
- require:
|
||||
|
@ -18,5 +18,8 @@ prometheus-config-user-install-{{ name }}-user-present:
|
||||
- createhome: false
|
||||
- groups:
|
||||
- {{ name }}
|
||||
{%- if grains.os_family == 'MacOS' %}
|
||||
- unless: /usr/bin/dscl . list /Users | grep {{ name }} >/dev/null 2>&1
|
||||
{%- endif %}
|
||||
|
||||
{%- endfor %}
|
||||
|
@ -15,9 +15,17 @@ prometheus-service-clean-{{ name }}-service-dead:
|
||||
{%- if grains.kernel|lower == 'linux' %}
|
||||
- onlyif: systemctl list-unit-files | grep {{ name }} >/dev/null 2>&1
|
||||
{%- endif %}
|
||||
file.absent:
|
||||
- name: {{ prometheus.dir.service }}/{{ name }}.service
|
||||
- require:
|
||||
- service: prometheus-service-clean-{{ name }}-service-dead
|
||||
cmd.run:
|
||||
- onlyif: {{ grains.kernel|lower == 'linux' }}
|
||||
- name: systemctl daemon-reload
|
||||
- require:
|
||||
- file: prometheus-service-clean-{{ name }}-service-dead
|
||||
|
||||
{%- endif %}
|
||||
|
||||
{%- endfor %}
|
||||
|
||||
prometheus-config-file-var-file-absent:
|
||||
|
@ -23,13 +23,13 @@ prometheus-config-file-var-file-directory:
|
||||
|
||||
{%- for name in prometheus.wanted %}
|
||||
{%- if name in prometheus.service %}
|
||||
{%- if grains.kernel|lower == 'linux' %}
|
||||
|
||||
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 %}
|
||||
@ -43,9 +43,9 @@ prometheus-service-running-{{ name }}-service-running:
|
||||
- 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' %}
|
||||
- service: prometheus-service-running-{{ name }}-service-unmasked
|
||||
- onlyif: systemctl list-unit-files | grep {{ name }} >/dev/null 2>&1
|
||||
{%- endif %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user