roles/common: Add functionality to copy user keys to provisioning user
Signed-off-by: Alan Orth <alan.orth@gmail.com>
This commit is contained in:
@ -37,4 +37,8 @@
|
||||
|
||||
- include: provisioning.yml
|
||||
tags: provisioning
|
||||
|
||||
- include: ssh-keys.yml
|
||||
tags: ssh-keys
|
||||
|
||||
# vim: set sw=2 ts=2:
|
||||
|
11
roles/common/tasks/ssh-keys.yml
Normal file
11
roles/common/tasks/ssh-keys.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: Zero .ssh/authorized_keys for provisioning user
|
||||
file: dest={{ provisioning_user.home }}/.ssh/authorized_keys state=absent
|
||||
|
||||
- name: Add public keys to authorized_keys
|
||||
authorized_key: { user: '{{ provisioning_user.name }}', key: "{{ lookup('file',item) }}" }
|
||||
with_fileglob:
|
||||
# use descriptive names for keys, like: aorth-mzito-rsa.pub
|
||||
- ssh-pub-keys/*.pub
|
||||
|
||||
# vim: set sw=2 ts=2:
|
Reference in New Issue
Block a user