diff --git a/prometheus/archive/install.sls b/prometheus/archive/install.sls index 76744cc..4e83697 100644 --- a/prometheus/archive/install.sls +++ b/prometheus/archive/install.sls @@ -89,8 +89,8 @@ prometheus-archive-install-{{ name }}-file-directory: - group: {{ name }} - mode: '0755' - require: - - user: prometheus-config-user-install-{{ name }}-user-present - - group: prometheus-config-user-install-{{ name }}-user-present + - user: prometheus-config-users-install-{{ name }}-user-present + - group: prometheus-config-users-install-{{ name }}-group-present {%- endif %} {%- if grains.kernel|lower == 'linux' %} @@ -122,8 +122,8 @@ prometheus-archive-install-{{ name }}-managed-service: - require: - file: prometheus-archive-install-{{ name }}-file-directory - archive: prometheus-archive-install-{{ name }} - - user: prometheus-config-user-install-{{ name }}-user-present - - group: prometheus-config-user-install-{{ name }}-user-present + - user: prometheus-config-users-install-{{ name }}-user-present + - group: prometheus-config-users-install-{{ name }}-group-present cmd.run: - name: systemctl daemon-reload - require: diff --git a/prometheus/clientlibs/install.sls b/prometheus/clientlibs/install.sls index 4c8bf7d..9c62d82 100644 --- a/prometheus/clientlibs/install.sls +++ b/prometheus/clientlibs/install.sls @@ -16,16 +16,18 @@ include: prometheus-clientlibs-install-{{ name }}: file.directory: - name: {{ p.pkg.clientlibs[name]['path'] }} - - user: {{ p.identity.rootuser }} - - group: {{ p.identity.rootgroup }} - - mode: '0755' - makedirs: True - require_in: - archive: prometheus-clientlibs-install-{{ name }} + {%- if grains.os|lower != 'windows' %} + - user: {{ p.identity.rootuser }} + - group: {{ p.identity.rootgroup }} + - mode: '0755' - recurse: - user - group - mode + {%- endif %} archive.extracted: {{- format_kwargs(p.pkg.clientlibs[name]['archive']) }} - trim_output: true @@ -33,7 +35,9 @@ prometheus-clientlibs-install-{{ name }}: - force: {{ p.force }} - options: --strip-components=1 - retry: {{ p.retry_option|json }} + {%- if grains.os|lower != 'windows' %} - user: {{ p.identity.rootuser }} - group: {{ p.identity.rootgroup }} + {%- endif %} {%- endfor %} diff --git a/prometheus/config/file.sls b/prometheus/config/file.sls index 828e6d1..1b487e7 100644 --- a/prometheus/config/file.sls +++ b/prometheus/config/file.sls @@ -46,8 +46,8 @@ prometheus-config-file-{{ name }}-file-managed: config: {{ p.pkg.component[name]['config']|json }} - require: - file: prometheus-config-file-etc-file-directory - - user: prometheus-config-user-install-{{ name }}-user-present - - group: prometheus-config-user-install-{{ name }}-user-present + - user: prometheus-config-users-install-{{ name }}-user-present + - group: prometheus-config-users-install-{{ name }}-group-present - watch_in: - service: prometheus-service-running-{{ name }} diff --git a/prometheus/config/users.sls b/prometheus/config/users.sls index ba0a48e..5a61317 100644 --- a/prometheus/config/users.sls +++ b/prometheus/config/users.sls @@ -6,11 +6,13 @@ {%- for name in p.wanted.component %} -prometheus-config-user-install-{{ name }}-user-present: +prometheus-config-users-install-{{ name }}-group-present: group.present: - name: {{ name }} - require_in: - - user: prometheus-config-user-install-{{ name }}-user-present + - user: prometheus-config-users-install-{{ name }}-user-present + +prometheus-config-users-install-{{ name }}-user-present: user.present: - name: {{ name }} - groups: @@ -23,4 +25,5 @@ prometheus-config-user-install-{{ name }}-user-present: - unless: /usr/bin/dscl . list /Users | grep {{ name }} >/dev/null 2>&1 {%- endif %} {%- endif %} + {%- endfor %} diff --git a/prometheus/cpuarchmap.yaml b/prometheus/cpuarchmap.yaml new file mode 100644 index 0000000..57724e8 --- /dev/null +++ b/prometheus/cpuarchmap.yaml @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +# +# Setup variables using grains['cuparch'] based logic. +# You just need to add the key:values for an `osarch` that differ +# from `defaults.yaml` + `os_family.yaml`. +# Only add an `cpuarch` which is/will be supported by the formula +# +# If you do not need to provide defaults via the `cpuarch` grain, +# you will need to provide at least an empty dict in this file, e.g. +# cpuarch: {} +--- +# Windows has no 'osarch' grain +Default: + dingdong: null + +AMD64: + arch: amd64 diff --git a/prometheus/exporters/node_exporter/textfile_collectors/init.sls b/prometheus/exporters/node_exporter/textfile_collectors/init.sls index b77a76b..5310ba2 100644 --- a/prometheus/exporters/node_exporter/textfile_collectors/init.sls +++ b/prometheus/exporters/node_exporter/textfile_collectors/init.sls @@ -23,8 +23,8 @@ prometheus-exporters-{{ name }}-collector-textfile-dir: {%- endif %} - makedirs: True - requre: - - user: prometheus-config-user-install-{{ name }}-user-present - - group: prometheus-config-user-install-{{ name }}-user-present + - user: prometheus-config-users-install-{{ name }}-user-present + - group: prometheus-config-users-install-{{ name }}-group-present {%- endif %} {%- for k, v in p.get('exporters', {}).get(name, {}).get('textfile_collectors', {}).items() %} diff --git a/prometheus/map.jinja b/prometheus/map.jinja index f9d2478..49f75fb 100644 --- a/prometheus/map.jinja +++ b/prometheus/map.jinja @@ -4,6 +4,7 @@ {%- set tplroot = tpldir.split('/')[0] %} {%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %} {%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %} +{%- import_yaml tplroot ~ "/cpuarchmap.yaml" as cpuarchmap %} {%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %} {%- set _config = salt['config.get'](tplroot, default={}) %} @@ -12,7 +13,9 @@ default=tplroot, merge=salt['grains.filter_by']( osfamilymap, grain='os_family', merge=salt['grains.filter_by']( osarchmap, grain='osarch', - merge=salt['grains.filter_by']( _config, default='lookup' + merge=salt['grains.filter_by']( cpuarchmap, grain='cpuarch', + merge=salt['grains.filter_by']( _config, default='lookup' + ) ) ) ) diff --git a/prometheus/service/args/install.sls b/prometheus/service/args/install.sls index e30b902..bec3bde 100644 --- a/prometheus/service/args/install.sls +++ b/prometheus/service/args/install.sls @@ -31,8 +31,8 @@ prometheus-service-args-{{ name }}-data-dir: - watch_in: - service: prometheus-service-running-{{ name }} - require: - - user: prometheus-config-user-install-{{ name }}-user-present - - group: prometheus-config-user-install-{{ name }}-user-present + - user: prometheus-config-users-install-{{ name }}-user-present + - group: prometheus-config-users-install-{{ name }}-group-present {%- endif %} {%- if grains.os_family == 'FreeBSD' %}