2019-04-24 18:18:44 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=sls
|
|
|
|
|
|
|
|
{#- Get the `tplroot` from `tpldir` #}
|
|
|
|
{%- set tplroot = tpldir.split('/')[0] %}
|
|
|
|
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
|
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
|
|
|
|
2019-06-08 19:39:21 +02:00
|
|
|
{%- if 'config' in prometheus and prometheus.config %}
|
|
|
|
{%- if prometheus.pkg.use_upstream_archive %}
|
|
|
|
{%- set sls_package_install = tplroot ~ '.archive.install' %}
|
|
|
|
{%- else %}
|
|
|
|
{%- set sls_package_install = tplroot ~ '.package.install' %}
|
|
|
|
{%- endif %}
|
|
|
|
|
2019-04-24 18:18:44 +02:00
|
|
|
include:
|
|
|
|
- {{ sls_package_install }}
|
|
|
|
|
2019-06-08 19:39:21 +02:00
|
|
|
prometheus-config-file-file-managed-config_file:
|
2019-04-24 18:18:44 +02:00
|
|
|
file.managed:
|
|
|
|
- name: {{ prometheus.config_file }}
|
|
|
|
- source: {{ files_switch(['prometheus.yml.jinja'],
|
2019-06-08 19:39:21 +02:00
|
|
|
lookup='prometheus-config-file-file-managed-config_file'
|
2019-04-24 18:18:44 +02:00
|
|
|
)
|
|
|
|
}}
|
|
|
|
- mode: 644
|
|
|
|
- user: root
|
|
|
|
- group: {{ prometheus.rootgroup }}
|
2019-05-31 12:02:41 +02:00
|
|
|
- makedirs: True
|
2019-04-24 18:18:44 +02:00
|
|
|
- template: jinja
|
|
|
|
- context:
|
|
|
|
config: {{ prometheus.config|json }}
|
|
|
|
- require:
|
|
|
|
- sls: {{ sls_package_install }}
|
2019-06-08 19:39:21 +02:00
|
|
|
|
|
|
|
{%- endif %}
|