summaryrefslogtreecommitdiffstats
path: root/salt/profile/prometheus/targets.sls
blob: 5f29e73dce683fa5ee0c93f4156df1488c60c608 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{%- set mypillar = salt['pillar.get']('profile:prometheus:targets') %}
{%- set targetsdir = '/etc/prometheus/targets' %}

{%- if mypillar | length %}
{{ targetsdir }}:
  file.directory:
    - group: prometheus

{%- for group, nodes in mypillar.items() %}
{{ targetsdir }}/{{ group }}.json:
  file.serialize:
    - dataset: {{ nodes }}
    - serializer: json
{%- endfor %}

{%- else %}
{%- do salt.log.debug('profile.prometheus: no targets defined') %}
{%- endif %}