36 lines
836 B
Plaintext
36 lines
836 B
Plaintext
---
|
|
{%- from "users/map.jinja" import users with context -%}
|
|
|
|
{%- for name, user in users.items() %}
|
|
{%- if "sys" in user.roles %}
|
|
{%- if not user.enabled %}
|
|
user-{{ name }}:
|
|
user.absent:
|
|
- name: {{ name }}
|
|
{%- endif %}
|
|
|
|
{%- if user.enabled %}
|
|
user-{{ name }}:
|
|
user.present:
|
|
- name: {{ 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: {{ user.optional_groups }}{% endif %}
|
|
- remove_groups: False
|
|
|
|
user-{{ name }}-config-dir:
|
|
file.directory:
|
|
- name: {{ user.home }}/.config
|
|
- user: {{ name }}
|
|
- group: {{ user.gid }}
|
|
- mode: 0755
|
|
{%- endif %}
|
|
{%- endif %}
|
|
|
|
{% endfor %}
|