groups: support `absent` like for users.

Also remove warning for passing unknown arguments on group.absent
This commit is contained in:
Adrien "ze" Urban 2019-03-07 11:53:59 +01:00
parent b8c6844e10
commit 7845013a39
1 changed files with 9 additions and 5 deletions

View File

@ -5,13 +5,17 @@
{% 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') }}
- system: {{ setting.get('system',"False") }}
{% endif %}
{% endfor %}
{%- for name, user in pillar.get('users', {}).items()