0e65cc345b
Avoid this failure when installing the package: ``` Setting up prometheus (2.24.1+ds-1+b5) ... adduser: The user `prometheus' already exists, but is not a system user. Exiting. dpkg: error processing package prometheus (--configure): installed prometheus package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: prometheus ```
33 lines
999 B
Plaintext
33 lines
999 B
Plaintext
# -*- coding: utf-8 -*-
|
|
# vim: ft=sls
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
|
|
|
{%- for name in p.wanted.component %}
|
|
|
|
prometheus-config-users-install-{{ name }}-group-present:
|
|
group.present:
|
|
- name: {{ name }}
|
|
- require_in:
|
|
- user: prometheus-config-users-install-{{ name }}-user-present
|
|
|
|
prometheus-config-users-install-{{ name }}-user-present:
|
|
user.present:
|
|
- name: {{ name }}
|
|
- groups:
|
|
- {{ name }}
|
|
{%- if grains.os != 'Windows' %}
|
|
- shell: /bin/false
|
|
{%- if grains.kernel|lower == 'linux' %}
|
|
- createhome: false
|
|
{%- if grains.get('osfinger', '') in ['Debian-11'] %}
|
|
- system: true
|
|
{%- endif %}
|
|
{%- elif grains.os_family == 'MacOS' %}
|
|
- unless: /usr/bin/dscl . list /Users | grep {{ name }} >/dev/null 2>&1
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|