Browse Source

Merge pull request #116 from salt-formulas/add-del-users-in-grups

manage group user membership
pull/117/head
Petr Jediný 7 years ago
parent
commit
9dcb5e1afc
2 changed files with 13 additions and 0 deletions
  1. +8
    -0
      linux/system/group.sls
  2. +5
    -0
      tests/pillar/system.sls

+ 8
- 0
linux/system/group.sls View File

@@ -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 @@ system_group_{{ group_name }}:
{%- 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 %}


+ 5
- 0
tests/pillar/system.sls View File

@@ -67,8 +67,13 @@ linux:
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

Loading…
Cancel
Save