fix(windows): windows has no osarch grain
This commit is contained in:
		
							parent
							
								
									79db2125f7
								
							
						
					
					
						commit
						468e420b34
					
				@ -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:
 | 
			
		||||
 | 
			
		||||
@ -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 %}
 | 
			
		||||
 | 
			
		||||
@ -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 }}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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 %}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								prometheus/cpuarchmap.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								prometheus/cpuarchmap.yaml
									
									
									
									
									
										Normal file
									
								
							@ -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
 | 
			
		||||
@ -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() %}
 | 
			
		||||
 | 
			
		||||
@ -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'
 | 
			
		||||
            )
 | 
			
		||||
          )
 | 
			
		||||
        )
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
@ -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' %}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user