mirror of
https://github.com/saltstack-formulas/users-formula.git
synced 2026-05-22 23:54:21 +02:00
Added authorized_keys template, update init for support.
This commit is contained in:
parent
76610eb63e
commit
2f442b1e0d
6
users/files/authorized_keys.jinja
Normal file
6
users/files/authorized_keys.jinja
Normal file
@ -0,0 +1,6 @@
|
||||
{% for name, user in pillar.get('users', {}).items() if user.absent is not defined or not user.absent %}
|
||||
|
||||
{% for auth in user['ssh_auth'] %}
|
||||
ssh_auth_{{ name }}_{{ loop.index0 }} {{ auth }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
@ -112,17 +112,14 @@ user_{{ name }}_public_key:
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if 'ssh_auth' in user %}
|
||||
{% for auth in user['ssh_auth'] %}
|
||||
ssh_auth_{{ name }}_{{ loop.index0 }}:
|
||||
ssh_auth.present:
|
||||
file.managed:
|
||||
- name: /home/{{ name }}/.ssh/authorized_keys
|
||||
- source: salt://users/files/authorized_keys.jinja
|
||||
- user: {{ name }}
|
||||
- name: {{ auth }}
|
||||
- require:
|
||||
- file: {{ name }}_user
|
||||
- user: {{ name }}_user
|
||||
{% endfor %}
|
||||
- group: {{ name }}
|
||||
- mode: 644
|
||||
- template: jinja
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user