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

{%- from "linux/map.jinja" import system with context %} {%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %} {%- 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() %} {%- for group_name, group in system.group.iteritems() %}


{%- if group.enabled %} {%- if group.enabled %}
{%- if group.gid is defined and group.gid %} {%- if group.gid is defined and group.gid %}
- gid: {{ group.gid }} - gid: {{ group.gid }}
{%- endif %} {%- endif %}
{{ set_p('addusers', group)|indent(2, True) }}
{{ set_p('delusers', group)|indent(2, True) }}


{%- else %} {%- else %}



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

name: testgroup name: testgroup
gid: 9999 gid: 9999
system: true system: true
addusers:
- salt_user1
- salt_user2
db-ops: db-ops:
enabled: true enabled: true
delusers:
- salt_user1
salt-ops: salt-ops:
enabled: true enabled: true
name: salt-ops name: salt-ops

Loading…
Cancel
Save