summaryrefslogtreecommitdiffstats
path: root/pillar/top.sls
blob: ac21037ec7d6fd7683baa5a102c0bd4df6790f70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{%- set id = salt['grains.get']('id') -%}
{%- set roles = salt['http.query']('http://machine-roles.lysergic.dev:4580/roles', decode=True, decode_type='json', params={"machine": id})['dict']['roles'] -%}

{{ saltenv }}:
  '*':
    - common
  'id:{{ id }}':
    - match: grain
    - ignore_missing: True
    - id.{{ id.replace('.', '_') }}
{%- if roles | length > 0 %}
  '{{ id }}':
  {% for role in roles %}
    - ignore_missing: True
    - role.{{ role }}
  {%- endfor %}
{%- endif %}