paulbsd-salt/states/users/users.sls
2020-07-10 00:58:55 +02:00

32 lines
729 B
Plaintext

---
{%- from "users/map.jinja" import users with context -%}
{%- for user in users %}
{%- if not user.enabled %}
user-{{ user.name }}:
user.absent:
- name: {{ user.name }}
{%- endif %}
{%- endfor %}
{%- for user in users %}
{%- if user.enabled %}
user-{{ user.name }}:
user.present:
- name: {{ user.name }}
- fullname: {{ user.fullname }}
- shell: {{ user.shell }}
- home: {{ user.home }}
- password: {{ user.password }}
- hash_password: True
- gid: {{ user.gid }}
- allow_gid_change: True
{%- if user.optional_groups is defined %}
- optional_groups:
{%- for opt_group in user.optional_groups %}
- {{ opt_group }}
{%- endfor %}
{%- endif %}
{%- endif %}
{% endfor %}