|
|
|
|
|
|
|
|
- group: {{ group }} |
|
|
- group: {{ group }} |
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
|
|
|
|
|
|
{% if 'privkey' in user %} |
|
|
|
|
|
|
|
|
{% if 'ssh_keys' in user %} |
|
|
user_{{ name }}_private_key: |
|
|
user_{{ name }}_private_key: |
|
|
file.managed: |
|
|
file.managed: |
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/id_rsa |
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/id_rsa |
|
|
- user: {{ name }} |
|
|
- user: {{ name }} |
|
|
- group: {{ user_group }} |
|
|
- group: {{ user_group }} |
|
|
- mode: 600 |
|
|
- mode: 600 |
|
|
- source: salt://keys/{{ user['privkey'] }} |
|
|
|
|
|
|
|
|
- contents: {{ user['ssh_keys']['privkey'] }} |
|
|
- require: |
|
|
- require: |
|
|
- user: {{ name }}_user |
|
|
- user: {{ name }}_user |
|
|
{% for group in user.get('groups', []) %} |
|
|
{% for group in user.get('groups', []) %} |
|
|
|
|
|
|
|
|
file.managed: |
|
|
file.managed: |
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/id_rsa.pub |
|
|
- name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/id_rsa.pub |
|
|
- user: {{ name }} |
|
|
- user: {{ name }} |
|
|
- group: {{ name }} |
|
|
|
|
|
|
|
|
- group: {{ user_group }} |
|
|
- mode: 644 |
|
|
- mode: 644 |
|
|
- source: salt://keys/{{ user['privkey'] }}.pub |
|
|
|
|
|
|
|
|
- contents: {{ user['ssh_keys']['pubkey'] }} |
|
|
- require: |
|
|
- require: |
|
|
- user: {{ name }}_user |
|
|
- user: {{ name }}_user |
|
|
{% for group in user.get('groups', []) %} |
|
|
{% for group in user.get('groups', []) %} |
|
|
|
|
|
|
|
|
/etc/sudoers.d/{{ name }}: |
|
|
/etc/sudoers.d/{{ name }}: |
|
|
file.append: |
|
|
file.append: |
|
|
- text: |
|
|
- text: |
|
|
- "{{ name }} ALL=(ALL) NOPASSWD: ALL" |
|
|
|
|
|
|
|
|
{% for rule in user.get('sudo_rules', []) %} |
|
|
|
|
|
- {{ rule }} |
|
|
|
|
|
{% endfor %} |
|
|
- require: |
|
|
- require: |
|
|
- file: sudoer-defaults |
|
|
- file: sudoer-defaults |
|
|
- file: sudoer-{{ name }} |
|
|
- file: sudoer-{{ name }} |