diff --git a/pillar.example b/pillar.example index 23c99aa..220badc 100644 --- a/pillar.example +++ b/pillar.example @@ -42,6 +42,9 @@ users: gid: 500 groups: - users + optional_groups: + - some_groups_that_might + - not_exist_on_all_minions ssh_key_type: rsa # You can inline the private keys ... ssh_keys: diff --git a/users/init.sls b/users/init.sls index 8e917ea..69e513d 100644 --- a/users/init.sls +++ b/users/init.sls @@ -135,6 +135,12 @@ users_{{ name }}_user: {% for group in user.get('groups', []) -%} - {{ group }} {% endfor %} + {% if 'optional_groups' in user %} + - optional_groups: + {% for optional_group in user['optional_groups'] -%} + - {{optional_group}} + {% endfor %} + {% endif %} - require: - group: {{ user_group }} {% for group in user.get('groups', []) -%}