2019-06-17 23:02:51 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=sls
|
|
|
|
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
|
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- if grains.kernel|lower == 'linux' and p.linux.altpriority|int > 0 and grains.os_family != 'Arch' %}
|
|
|
|
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
|
2019-06-17 23:02:51 +02:00
|
|
|
|
|
|
|
include:
|
|
|
|
- {{ sls_archive_install }}
|
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- if 'wanted' in p and p.wanted and 'component' in p.wanted and p.wanted.component %}
|
|
|
|
{%- for name in p.wanted.component %}
|
|
|
|
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
|
|
|
{%- set dir_symlink = p.dir.symlink ~ '/bin' %}
|
|
|
|
{%- if 'service' in p.pkg.component[name] %}
|
|
|
|
{%- set dir_symlink = p.dir.symlink ~ '/sbin' %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- for cmd in p.pkg.component[name]['commands'] %}
|
2019-06-17 23:02:51 +02:00
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
prometheus-server-alternatives-install-{{ name }}-{{ cmd }}:
|
2019-06-17 23:02:51 +02:00
|
|
|
cmd.run:
|
2020-05-14 01:27:23 +02:00
|
|
|
- name: update-alternatives --install {{ dir_symlink }}/{{ cmd }} link-prometheus-{{ name }}-{{ cmd }} {{ p.pkg.component[name]['path'] }}/{{ cmd }} {{ p.linux.altpriority }} # noqa 204
|
|
|
|
- unless:
|
|
|
|
- {{ grains.os_family not in ('Suse',) }}
|
|
|
|
- {{ p.pkg.use_upstream_repo }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- require:
|
2020-05-14 01:27:23 +02:00
|
|
|
- sls: {{ sls_archive_install }}
|
2019-06-17 23:02:51 +02:00
|
|
|
alternatives.install:
|
2020-05-14 01:27:23 +02:00
|
|
|
- name: link-prometheus-{{ name }}-{{ cmd }}
|
|
|
|
- link: {{ dir_symlink }}/{{ cmd }}
|
|
|
|
- path: {{ p.pkg.component[name]['path'] }}/{{ cmd }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- priority: {{ p.linux.altpriority }}
|
|
|
|
- order: 10
|
|
|
|
- require:
|
2020-05-14 01:27:23 +02:00
|
|
|
- sls: {{ sls_archive_install }}
|
|
|
|
- unless:
|
|
|
|
- {{ grains.os_family in ('Suse',) }}
|
|
|
|
- {{ p.pkg.use_upstream_repo }}
|
2019-06-17 23:02:51 +02:00
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
prometheus-server-alternatives-set-{{ name }}-{{ cmd }}:
|
2019-06-17 23:02:51 +02:00
|
|
|
alternatives.set:
|
2020-05-14 01:27:23 +02:00
|
|
|
- name: link-prometheus-{{ name }}-{{ cmd }}
|
|
|
|
- path: {{ p.pkg.component[name]['path'] }}/{{ cmd }}
|
2019-06-17 23:02:51 +02:00
|
|
|
- require:
|
2020-05-14 01:27:23 +02:00
|
|
|
- alternatives: prometheus-server-alternatives-install-{{ name }}-{{ cmd }}
|
|
|
|
- sls: {{ sls_archive_install }}
|
|
|
|
- unless:
|
|
|
|
- {{ grains.os_family in ('Suse',) }}
|
|
|
|
- {{ p.pkg.use_upstream_repo }}
|
2019-06-19 01:23:45 +02:00
|
|
|
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- endfor %}
|
2019-06-23 16:24:54 +02:00
|
|
|
{%- endif %}
|
2020-05-14 01:27:23 +02:00
|
|
|
{%- endfor %}
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
{%- endif %}
|