prometheus-formula/prometheus/clientlibs/install.sls
N ce5b7712c9 refactor(all): align to template-formula; add clientlibs feature
BREAKING CHANGE: The data dictionary is simplified and expanded.
Retest your states and update pillar data accordingly.
For developer convenience, clientlibs states were introduced.
See pillar.example, defaults.yaml, and docs/README.
2020-05-15 11:12:28 +01:00

39 lines
1.2 KiB
Plaintext

# -*- coding: utf-8 -*-
# vim: ft=sls
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
{%- set sls_package_install = tplroot ~ '.package.install' %}
include:
- {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
{%- for name in p.wanted.clientlibs %}
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 }}
- recurse:
- user
- group
- mode
archive.extracted:
{{- format_kwargs(p.pkg.clientlibs[name]['archive']) }}
- trim_output: true
- enforce_toplevel: false
- options: --strip-components=1
- retry: {{ p.retry_option|json }}
- user: {{ p.identity.rootuser }}
- group: {{ p.identity.rootgroup }}
{%- endfor %}