salt/pillar/top.sls
Georg Pfuetzenreuter 772f6b374a
Some checks failed
ci/lysergic/push/pipeline Pipeline failed
Enforce ID and roles in top
Adapt to current private pillar top:
- match ID grain for inclusion of ID files
- check for role existence

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2023-01-22 22:32:39 +01:00

17 lines
458 B
Plaintext

{%- 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 %}
- role.{{ role }}
{%- endfor %}
{%- endif %}