2023-01-21 01:00:22 +01:00
|
|
|
{%- set id = salt['grains.get']('id') -%}
|
2023-01-22 16:52:22 +01:00
|
|
|
{%- set roles = salt['http.query']('http://machine-roles.lysergic.dev:4580/roles', decode=True, decode_type='json', params={"machine": id})['dict']['roles'] -%}
|
2023-01-15 11:41:05 +01:00
|
|
|
|
|
|
|
{{ saltenv }}:
|
|
|
|
'*':
|
2023-01-26 19:30:15 +01:00
|
|
|
- global
|
2023-01-22 22:32:39 +01:00
|
|
|
'id:{{ id }}':
|
|
|
|
- match: grain
|
2023-01-15 12:37:11 +01:00
|
|
|
- ignore_missing: True
|
2023-01-15 11:41:05 +01:00
|
|
|
- id.{{ id.replace('.', '_') }}
|
2023-01-22 22:32:39 +01:00
|
|
|
{%- if roles | length > 0 %}
|
|
|
|
'{{ id }}':
|
|
|
|
{% for role in roles %}
|
|
|
|
- ignore_missing: True
|
2023-01-21 14:20:08 +01:00
|
|
|
- role.{{ role }}
|
|
|
|
{%- endfor %}
|
2023-01-22 22:32:39 +01:00
|
|
|
{%- endif %}
|