paulbsd-salt/states/users/users.sls

39 lines
835 B
Plaintext
Raw 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-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
2020-07-10 00:58:55 +02:00
{%- if user.optional_groups is defined %}
- optional_groups:
{%- for opt_group in user.optional_groups %}
- {{ opt_group }}
{%- endfor %}
{%- 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 %}
2020-07-10 00:58:55 +02:00
{% endfor %}