瀏覽代碼

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

manage group user membership
pull/117/head
Petr Jediný 7 年之前
父節點
當前提交
9dcb5e1afc
共有 2 個文件被更改,包括 13 次插入0 次删除
  1. +8
    -0
      linux/system/group.sls
  2. +5
    -0
      tests/pillar/system.sls

+ 8
- 0
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 @@ 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 查看文件

@@ -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…
取消
儲存