23 lines
546 B
YAML
23 lines
546 B
YAML
---
|
|
- name: Update ssh keys on all devices
|
|
hosts: all
|
|
tasks:
|
|
- import_tasks: tasks/preprocess-local-users.yml
|
|
|
|
- name: Ensure SSH directory exists
|
|
become: true
|
|
file:
|
|
state: directory
|
|
path: /home/{{ item.name }}/.ssh
|
|
loop: "{{ users_local }}"
|
|
|
|
- name: Put keys on remote
|
|
become: true
|
|
when: item.keys != []
|
|
authorized_key:
|
|
user: "{{ item.name }}"
|
|
key: "{{ item.sshkeys | join('\n') }}"
|
|
state: present
|
|
exclusive: yes
|
|
loop: "{{ users_local }}"
|