paulbsd-salt/states/users/users.sls

36 lines
836 B
Plaintext
Raw Permalink Normal View History

2020-07-10 00:58:55 +02:00
---
{%- from "users/map.jinja" import users with context -%}
{%- 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:
- 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 %}
user-{{ name }}:
2020-07-10 00:58:55 +02:00
user.present:
- 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 %}
2023-06-06 09:25:13 +02:00
- remove_groups: False
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 %}