This repository has been archived on 2024-05-02. You can view files and clone it, but cannot push or open issues or pull requests.
2019-09-01 17:57:23 +00:00
|
|
|
---
|
2019-12-01 19:14:25 +00:00
|
|
|
- name: Update ssh keys on all devices
|
|
|
|
hosts: all
|
2019-09-01 17:57:23 +00:00
|
|
|
tasks:
|
2019-12-01 19:14:25 +00:00
|
|
|
- import_tasks: tasks/preprocess-local-users.yml
|
2019-09-01 17:57:23 +00:00
|
|
|
|
2019-12-01 19:14:25 +00:00
|
|
|
- name: Ensure SSH directory exists
|
2019-09-01 17:57:23 +00:00
|
|
|
become: true
|
2019-12-01 19:14:25 +00:00
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
path: /home/{{ item.name }}/.ssh
|
|
|
|
loop: "{{ users_local }}"
|
2019-09-27 06:59:11 +00:00
|
|
|
|
2019-12-01 19:14:25 +00:00
|
|
|
- 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 }}"
|