blob: 8aa06e7429f9592219969932ba22525827bb8c2f (
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 }}:
'*':
- global
'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 %}
|