From eaff5ad447aeac7c376ad10ffc40612b51ff7ff0 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sat, 21 Jan 2023 14:20:08 +0100 Subject: [PATCH] Target roles without grains in tops Signed-off-by: Georg Pfuetzenreuter --- pillar/top.sls | 8 +++----- salt/top.sls | 7 ++++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pillar/top.sls b/pillar/top.sls index 872dc8b..3302bd8 100644 --- a/pillar/top.sls +++ b/pillar/top.sls @@ -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 %} diff --git a/salt/top.sls b/salt/top.sls index a534cc5..fbae23d 100644 --- a/salt/top.sls +++ b/salt/top.sls @@ -4,8 +4,9 @@ {{ saltenv }}: '*': - common + {%- if roles | len > 0 %} + '{{ id }}': {% for role in roles %} - 'roles:{{ role }}': - - match: grain - role.{{ role }} - {% endfor %} + {%- endfor %} + {%- endif %}