prometheus-formula/prometheus/clientlibs/install.sls

39 lines
1.2 KiB
Plaintext
Raw Normal View History

# -*- 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 %}