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:
parent
614f90a058
commit
1e2193efc9
1
roles/common/files/ssh-pub-keys/aorth-ed25519-rmbp.pub
Normal file
1
roles/common/files/ssh-pub-keys/aorth-ed25519-rmbp.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBsMqYkvBnQ51kybGNIAZq0Dkoo3nL1tti/VYIIlJiHH aorth@Alans-MBP
|
1
roles/common/files/ssh-pub-keys/aorth-rsa-rmbp.pub
Normal file
1
roles/common/files/ssh-pub-keys/aorth-rsa-rmbp.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDDvdEwl+1Ti3Ysr4qUQMwMcOUNjeZqpSikwONqr+qPtnmYImGTsJzpMh7wsMHHoONC55VYEMB06pP9d13TXziufZNqOnNIj4Z0ZPXTz+5BY8oU1cINr+Z4gxylhsgFRUc3J3lI99HHKUg/M7KyaFc0jNQOegm+cUHE7FSmWLdhjgVm5F3ex5UNuF/qXmn9W0mABbZPMU4OVQ5iDminkrMDTNX9Ay4xFM/ToRWxW6ZooYFbZx3XJ0YpHrpv8YvcdIEEWJ4E5FgcpUgyQXalROionqV+R5wUg1R+Taq6B5amnm5rgGl374rBaHsImq9ATfYZAmp7cIM3rVKidKNzwLT aorth@Alans-MacBook-Pro.local
|
@ -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:
|
Loading…
Reference in New Issue
Block a user