Compare commits

..

2 Commits

Author SHA1 Message Date
2d5e549872
fix(environ): remove stray control characters
Remove useless "%}" from comment in file.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-02-15 03:46:15 +01:00
b9b2e42ad2
feat(suse): support packaged installations
- add all components available in the default openSUSE Leap (OSS)
  repository to osfamilymap
- introduce global manage_user_group toggle to prevent the formula from
  changing users and groups managed by system packages

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-02-15 03:46:15 +01:00
10 changed files with 89 additions and 6 deletions

View File

@ -49,7 +49,7 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.4.1)
activesupport (7.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
@ -400,7 +400,7 @@ GEM
memoist (0.16.2)
method_source (1.0.0)
mini_mime (1.1.2)
minitest (5.17.0)
minitest (5.16.2)
mixlib-config (3.0.27)
tomlrb
mixlib-install (3.12.19)
@ -634,7 +634,7 @@ GEM
pastel (~> 0.8)
strings (~> 0.2.0)
tty-screen (~> 0.8)
tzinfo (2.0.5)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unf (0.1.4)

View File

@ -40,15 +40,19 @@ prometheus-config-file-{{ name }}-file-managed:
- template: jinja
{%- if grains.os != 'Windows' %}
- mode: 644
{%- if p.manage_user_group %}
- user: {{ name }}
- group: {{ name }}
{%- endif %}
{%- endif %}
- context:
config: {{ p.pkg.component[name]['config']|json }}
- require:
- file: prometheus-config-file-etc-file-directory
{%- if p.manage_user_group %}
- user: prometheus-config-users-install-{{ name }}-user-present
- group: prometheus-config-users-install-{{ name }}-group-present
{%- endif %}
- watch_in:
- service: prometheus-service-running-{{ name }}
@ -71,15 +75,19 @@ prometheus-config-file-{{ ef }}-file-managed:
- template: jinja
{%- if grains.os != 'Windows' %}
- mode: 644
{%- if p.manage_user_group %}
- user: {{ component }}
- group: {{ component }}
{%- endif %}
{%- endif %}
- context:
config: {{ p.extra_files[ef]['config'] }}
- require:
- file: prometheus-config-file-etc-file-directory
{%- if p.manage_user_group %}
- user: prometheus-config-users-install-{{ component }}-user-present
- group: prometheus-config-users-install-{{ component }}-group-present
{%- endif %}
- watch_in:
- service: prometheus-service-running-{{ component }}

View File

@ -24,9 +24,11 @@ prometheus-service-args-{{ name }}-data-dir:
- makedirs: True
- watch_in:
- service: prometheus-service-running-{{ name }}
{%- if p.manage_user_group %}
- require:
- user: prometheus-config-users-install-{{ name }}-user-present
- group: prometheus-config-users-install-{{ name }}-group-present
{%- endif %}
{%- endif %}
{% endif %}

View File

@ -4,6 +4,7 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
{%- if p.manage_user_group or p.pkg.use_upstream_archive %}
{%- for name in p.wanted.component %}
prometheus-config-users-install-{{ name }}-group-present:
@ -29,3 +30,4 @@ prometheus-config-users-install-{{ name }}-user-present:
{%- endif %}
{%- endfor %}
{%- endif %}

View File

@ -23,6 +23,8 @@ prometheus:
tmp: /tmp/prometheus
var: /var/lib/prometheus
manage_user_group: true
pkg:
uri: https://github.com/prometheus
use_upstream_repo: false

View File

@ -22,10 +22,12 @@ prometheus-exporters-{{ name }}-collector-textfile-dir:
- group: {{ name }}
{%- endif %}
- makedirs: True
{%- if p.manage_user_group %}
- require:
- user: prometheus-config-users-install-{{ name }}-user-present
- group: prometheus-config-users-install-{{ name }}-group-present
{%- endif %}
{%- endif %}
{%- for k, v in p.get('exporters', {}).get(name, {}).get('textfile_collectors', {}).items() %}
{%- if v.get('enable', False) %}

View File

@ -2,7 +2,7 @@
# File managed by Salt at <{{ source }}>.
# Your changes may be overwritten.
########################################################################
# Set the command-line arguments to pass to the server.%}"
# Set the command-line arguments to pass to the server."
{{ arg_name }}="{{ args }}"

View File

@ -219,7 +219,66 @@ RedHat:
sslcacert: /etc/pki/tls/certs/ca-bundle.crt
metadata_expire: 300
Suse: {}
Suse:
manage_user_group: false
pkg:
use_upstream_repo: false
use_upstream_package: false
use_upstream_archive: false
component:
alertmanager:
name: golang-github-prometheus-alertmanager
service:
name: prometheus-alertmanager
environ_file: /etc/sysconfig/prometheus-alertmanager
args:
config.file: /etc/prometheus/alertmanager.yml
config_file: /etc/prometheus/alertmanager.yml
prometheus:
name: golang-github-prometheus-prometheus
service:
name: prometheus
environ_file: /etc/sysconfig/prometheus
environ:
environ_arg_name: ARGS
config_file: /etc/prometheus/prometheus.yml
blackbox_exporter:
name: prometheus-blackbox_exporter
config_file: /etc/prometheus/blackbox.yml
service:
name: prometheus-blackbox_exporter
hacluster_exporter:
name: prometheus-ha_cluster_exporter
environ_file: /etc/sysconfig/prometheus-ha_cluster_exporter
environ:
environ_arg_name: ARGS
service:
name: prometheus-ha_cluster_exporter
node_exporter:
name: golang-github-prometheus-node_exporter
service:
name: prometheus-node_exporter
environ_file: /etc/sysconfig/prometheus-node_exporter
environ:
environ_arg_name: ARGS
postgres_exporter:
name: prometheus-postgres_exporter
service:
name: prometheus-postgres_exporter
environ_file: /etc/sysconfig/prometheus-postgres_exporter
environ:
environ_arg_name: POSTGRES_EXPORTER_PARAMS
saptune_exporter:
name: prometheus-saptune_exporter
service:
name: prometheus-saptune_exporter
webhook_snmp:
name: prometheus-webhook-snmp
service:
name: prometheus-webhook-snmp
environ_file: /etc/default/prometheus-webhook-snmp
environ:
environ_arg_name: PROMETHEUS_WEBHOOK_SNMP_OPTIONS
Gentoo:
pkg:

View File

@ -30,9 +30,11 @@ prometheus-service-args-{{ name }}-data-dir:
- makedirs: True
- watch_in:
- service: prometheus-service-running-{{ name }}
{%- if p.manage_user_group %}
- require:
- user: prometheus-config-users-install-{{ name }}-user-present
- group: prometheus-config-users-install-{{ name }}-group-present
{%- endif %}
{%- endif %}
{%- if grains.os_family == 'FreeBSD' %}

View File

@ -13,6 +13,12 @@ prometheus:
- alertmanager
- node_exporter
- blackbox_exporter
{%- if grains.os == 'SUSE' %}
- hacluster_exporter
- postgres_exporter
- saptune_exporter
- webhook_snmp
{%- endif %}
exporters:
node_exporter:
@ -31,7 +37,7 @@ prometheus:
pkg:
# yamllint disable-line rule:braces rule:commas
use_upstream_repo: {{ false if grains.os_family|lower in ('debian',) else true }}
use_upstream_repo: {{ false if grains.os_family|lower in ('debian','suse',) else true }}
use_upstream_archive: false
clientlibs: