Target roles without grains in tops

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-01-21 14:20:08 +01:00
parent 91fd60c5a3
commit 12f0a7bce0
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57
2 changed files with 7 additions and 8 deletions

View File

@ -4,11 +4,9 @@
{{ saltenv }}:
'*':
- common
{% for role in roles %}
'roles:{{ role }}':
- match: grain
- role.{{ role }}
{%- endfor %}
'{{ id }}':
- ignore_missing: True
- id.{{ id.replace('.', '_') }}
{% for role in roles %}
- role.{{ role }}
{%- endfor %}

View File

@ -4,8 +4,9 @@
{{ saltenv }}:
'*':
- common
{%- if roles | length > 0 %}
'{{ id }}':
{% for role in roles %}
'roles:{{ role }}':
- match: grain
- role.{{ role }}
{% endfor %}
{%- endfor %}
{%- endif %}