Przeglądaj źródła

Merge pull request #194 from ze42/groups_members

Groups members
tags/v0.45.0
Niels Abspoel 5 lat temu
rodzic
commit
d4f8cf955d
Brak konta powiązanego z adresem e-mail autora
2 zmienionych plików z 26 dodań i 5 usunięć
  1. +14
    -0
      pillar.example
  2. +12
    -5
      users/init.sls

+ 14
- 0
pillar.example Wyświetl plik

@@ -176,3 +176,17 @@ users:
absent_users:
- donald
- bad_guy

groups:
badguys:
absent: True
niceguys:
gid: 4242
system: False
addusers: root
delusers: toor
ssl-cert:
system: True
members:
- www-data
- openldap

+ 12
- 5
users/init.sls Wyświetl plik

@@ -5,13 +5,20 @@
{% set used_user_files = [] %}

{% for group, setting in salt['pillar.get']('groups', {}).items() %}
users_group_{{ setting.get('state', "present") }}_{{ group }}:
group.{{ setting.get('state', "present") }}:
{% if setting.absent is defined and setting.absent or setting.get('state', "present") == 'absent' %}
users_group_absent_{{ group }}:
group.absent:
- name: {{ group }}
{%- if setting.get('gid') %}
- gid: {{setting.get('gid') }}
{%- endif %}
{% else %}
users_group_present_{{ group }}:
group.present:
- name: {{ group }}
- gid: {{ setting.get('gid', "null") }}
- system: {{ setting.get('system',"False") }}
- members: {{ setting.get('members')|json }}
- addusers: {{ setting.get('addusers')|json }}
- delusers: {{ setting.get('delusers')|json }}
{% endif %}
{% endfor %}

{%- for name, user in pillar.get('users', {}).items()

Ładowanie…
Anuluj
Zapisz