Merge pull request #116 from salt-formulas/add-del-users-in-grups
manage group user membership
diff --git a/linux/system/group.sls b/linux/system/group.sls
index d990889..2746eff 100644
--- a/linux/system/group.sls
+++ b/linux/system/group.sls
@@ -1,6 +1,12 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %}
+{%- macro set_p(paramname, dictvar) -%}
+ {%- if paramname in dictvar -%}
+- {{ paramname }}: {{ dictvar[paramname] }}
+ {%- endif -%}
+{%- endmacro -%}
+
{%- for group_name, group in system.group.iteritems() %}
{%- if group.enabled %}
@@ -14,6 +20,8 @@
{%- if group.gid is defined and group.gid %}
- gid: {{ group.gid }}
{%- endif %}
+{{ set_p('addusers', group)|indent(2, True) }}
+{{ set_p('delusers', group)|indent(2, True) }}
{%- else %}
diff --git a/tests/pillar/system.sls b/tests/pillar/system.sls
index bdb70be..7f7b087 100644
--- a/tests/pillar/system.sls
+++ b/tests/pillar/system.sls
@@ -67,8 +67,13 @@
name: testgroup
gid: 9999
system: true
+ addusers:
+ - salt_user1
+ - salt_user2
db-ops:
enabled: true
+ delusers:
+ - salt_user1
salt-ops:
enabled: true
name: salt-ops