2019-06-17 23:02:51 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=sls
|
|
|
|
|
|
|
|
{#- Get the `tplroot` from `tpldir` #}
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
|
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
2019-06-22 19:24:19 +02:00
|
|
|
{%- set sls_archive_install = tplroot ~ '.archive' %}
|
2019-06-17 23:02:51 +02:00
|
|
|
|
2019-06-19 01:23:45 +02:00
|
|
|
{%- if grains.kernel|lower in ('linux',) and p.linux.altpriority|int > 0 %}
|
2019-06-17 23:02:51 +02:00
|
|
|
|
|
|
|
include:
|
|
|
|
- {{ sls_archive_install }}
|
|
|
|
|
2019-06-20 02:36:58 +02:00
|
|
|
{%- for name in p.wanted %}
|
|
|
|
{%- set bundle = name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) %}
|
2019-06-23 15:04:48 +02:00
|
|
|
{%- if grains.os_family == 'Suse' %}
|
2019-06-17 23:02:51 +02:00
|
|
|
|
2019-06-20 02:36:58 +02:00
|
|
|
prometheus-archive-alternatives-install-{{ name }}-home-cmd-run:
|
2019-06-17 23:02:51 +02:00
|
|
|
cmd.run:
|
2019-10-09 19:17:43 +02:00
|
|
|
- name: |
|
|
|
|
update-alternatives --install {{ p.dir.basedir }}/{{ name }} \
|
|
|
|
prometheus-{{ name }}-home {{ p.dir.basedir }}/{{ bundle }} \
|
|
|
|
{{ p.linux.altpriority }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- watch:
|
2019-06-20 02:36:58 +02:00
|
|
|
- archive: prometheus-archive-install-{{ name }}-archive-extracted
|
2019-06-19 01:23:45 +02:00
|
|
|
|
2019-06-23 15:04:48 +02:00
|
|
|
{%- else %}
|
|
|
|
|
2019-06-20 02:36:58 +02:00
|
|
|
prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install:
|
2019-06-17 23:02:51 +02:00
|
|
|
alternatives.install:
|
2019-06-20 02:36:58 +02:00
|
|
|
- name: prometheus-{{ name }}-home
|
|
|
|
- link: {{ p.dir.basedir }}/{{ name }}
|
|
|
|
- path: {{ p.dir.basedir }}/{{ bundle }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- priority: {{ p.linux.altpriority }}
|
|
|
|
- order: 10
|
|
|
|
- watch:
|
2019-06-20 02:36:58 +02:00
|
|
|
- archive: prometheus-archive-install-{{ name }}-archive-extracted
|
2019-06-17 23:02:51 +02:00
|
|
|
|
2019-06-20 02:36:58 +02:00
|
|
|
prometheus-archive-alternatives-install-{{ name }}-home-alternatives-set:
|
2019-06-17 23:02:51 +02:00
|
|
|
alternatives.set:
|
2019-06-20 02:36:58 +02:00
|
|
|
- name: prometheus-{{ name }}-home
|
|
|
|
- path: {{ p.dir.basedir }}/{{ bundle }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- require:
|
2019-06-20 02:36:58 +02:00
|
|
|
- alternatives: prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install
|
2019-06-17 23:02:51 +02:00
|
|
|
|
2019-06-23 15:04:48 +02:00
|
|
|
{%- endif %}
|
|
|
|
{% for b in p.pkg[name]['binaries'] %}
|
2019-06-23 16:24:54 +02:00
|
|
|
{%- if grains.os_family == 'Suse' %}
|
2019-06-19 01:23:45 +02:00
|
|
|
|
2019-06-23 16:24:54 +02:00
|
|
|
prometheus-archive-alternatives-install-{{ name }}-cmd-run-{{ b }}-alternative:
|
2019-06-17 23:02:51 +02:00
|
|
|
cmd.run:
|
2019-10-09 19:17:43 +02:00
|
|
|
- name: |
|
|
|
|
update-alternatives --install /usr/local/bin/{{ b }} \
|
|
|
|
prometheus-{{ name }}-{{ b }} {{ p.dir.basedir }}/{{ bundle }}/{{ b }} \
|
|
|
|
{{ p.linux.altpriority }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- require:
|
2019-06-20 02:36:58 +02:00
|
|
|
- cmd: prometheus-archive-alternatives-install-{{ name }}-home-cmd-run
|
2019-06-23 16:24:54 +02:00
|
|
|
|
|
|
|
{%- else %}
|
|
|
|
|
|
|
|
prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}:
|
2019-06-17 23:02:51 +02:00
|
|
|
alternatives.install:
|
2019-06-20 02:36:58 +02:00
|
|
|
- name: prometheus-{{ name }}-{{ b }}
|
|
|
|
- link: /usr/local/bin/{{ b }}
|
|
|
|
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- priority: {{ p.linux.altpriority }}
|
|
|
|
- order: 10
|
|
|
|
- require:
|
2019-06-20 02:36:58 +02:00
|
|
|
- alternatives: prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install
|
2019-06-17 23:02:51 +02:00
|
|
|
|
2019-06-20 02:36:58 +02:00
|
|
|
prometheus-archive-alternatives-install-{{ name }}-alternatives-set-{{ b }}:
|
2019-06-17 23:02:51 +02:00
|
|
|
alternatives.set:
|
2019-06-20 02:36:58 +02:00
|
|
|
- name: prometheus-{{ name }}-{{ b }}
|
|
|
|
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- require:
|
2019-06-20 02:36:58 +02:00
|
|
|
- alternatives: prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}
|
2019-06-19 01:23:45 +02:00
|
|
|
|
2019-06-23 16:24:54 +02:00
|
|
|
{%- endif %}
|
2019-06-20 02:36:58 +02:00
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
2019-06-19 01:23:45 +02:00
|
|
|
{%- endif %}
|