27 lines
668 B
YAML
27 lines
668 B
YAML
- include_role:
|
|
name: per_user
|
|
|
|
- name: Create ssh directory
|
|
file:
|
|
name: "{{ account_homedir.stdout }}/.ssh"
|
|
state: directory
|
|
mode: 0700
|
|
owner: "{{ account_name.stdout }}"
|
|
group: "{{ group_name.stdout }}"
|
|
|
|
- name: Set authorized keys
|
|
authorized_key:
|
|
user: "{{ account_name.stdout }}"
|
|
key: |
|
|
{% for user in users[account_name.stdout].authorized_keys %}
|
|
{{ lookup('file', './files/keys/' + user + '.pub') }}
|
|
{% endfor %}
|
|
exclusive: true
|
|
notify: "restart sshd"
|
|
|
|
- import_tasks: tasks/peruser_freebsd.yaml
|
|
when: 'os_flavor == "freebsd"'
|
|
|
|
- import_tasks: tasks/peruser_linux.yaml
|
|
when: 'os_flavor == "linux"'
|