2020-07-10 00:58:55 +02:00
|
|
|
---
|
|
|
|
{%- from "users/map.jinja" import users with context -%}
|
|
|
|
|
2022-06-08 23:48:21 +02:00
|
|
|
{%- for name, user in users.items() %}
|
2022-12-24 17:50:27 +01:00
|
|
|
{%- if "sys" in user.roles %}
|
2022-06-10 00:39:52 +02:00
|
|
|
{%- if not user.enabled %}
|
|
|
|
user-{{ name }}:
|
|
|
|
user.absent:
|
2022-06-08 23:48:21 +02:00
|
|
|
- name: {{ name }}
|
2020-07-10 00:58:55 +02:00
|
|
|
{%- endif %}
|
2022-06-10 00:39:52 +02:00
|
|
|
|
2020-07-10 00:58:55 +02:00
|
|
|
{%- if user.enabled %}
|
2022-06-08 23:48:21 +02:00
|
|
|
user-{{ name }}:
|
2020-07-10 00:58:55 +02:00
|
|
|
user.present:
|
2022-06-08 23:48:21 +02:00
|
|
|
- name: {{ name }}
|
2020-07-10 00:58:55 +02:00
|
|
|
- fullname: {{ user.fullname }}
|
|
|
|
- shell: {{ user.shell }}
|
|
|
|
- home: {{ user.home }}
|
|
|
|
- password: {{ user.password }}
|
2020-09-12 17:41:35 +02:00
|
|
|
- hash_password: true
|
2020-07-10 00:58:55 +02:00
|
|
|
- gid: {{ user.gid }}
|
2020-09-12 17:41:35 +02:00
|
|
|
- allow_gid_change: true
|
2022-12-24 17:50:27 +01:00
|
|
|
{% if user.optional_groups is defined %}- optional_groups: {{ user.optional_groups }}{% endif %}
|
2022-12-06 20:27:38 +01:00
|
|
|
|
|
|
|
user-{{ name }}-config-dir:
|
|
|
|
file.directory:
|
|
|
|
- name: {{ user.home }}/.config
|
|
|
|
- user: {{ name }}
|
|
|
|
- group: {{ user.gid }}
|
|
|
|
- mode: 0755
|
2022-01-25 00:20:21 +01:00
|
|
|
{%- endif %}
|
2022-12-24 17:50:27 +01:00
|
|
|
{%- endif %}
|
2022-01-25 00:20:21 +01:00
|
|
|
|
2020-07-10 00:58:55 +02:00
|
|
|
{% endfor %}
|