-
Notifications
You must be signed in to change notification settings - Fork 2
/
accounts.sls
39 lines (36 loc) · 963 Bytes
/
accounts.sls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{% from "node/defaults.jinja" import settings %}
{% from "ssh/lib.sls" import ssh_keys_update %}
include:
- .hostname
{% if settings.users %}
{% for u in settings.users %}
user_present_{{ u.name }}:
user.present:
- name: {{ u.name }}
- remove_groups: false
{%- for name,value in u.items() %}
{%- if name != 'name' and name != 'use_authorized_keys' %}
{{ name }}: {{ value }}
{%- endif %}
{%- endfor %}
{%- if u.use_authorized_keys|d(False) %}
{{ ssh_keys_update(u.name,
salt['pillar.get']('ssh_authorized_keys', False),
salt['pillar.get']('ssh_deprecated_keys', False)
)
}}
{%- endif %}
{% endfor %}
{% endif %}
{% if settings.groups %}
{% for u in settings.groups %}
group_present_{{ u.name }}:
group.present:
- name: {{ u.name }}
{%- for name,value in u.items() %}
{%- if name != 'name' %}
{{ name }}: {{ value }}
{%- endif %}
{%- endfor %}
{% endfor %}
{% endif %}