update
This commit is contained in:
14
roles/05-update/tasks/01-check-ssh-keys.yml
Normal file
14
roles/05-update/tasks/01-check-ssh-keys.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Check for new SSH keys in authorized_keys
|
||||
stat:
|
||||
path: /home/{{ ansible_user }}/.ssh/authorized_keys
|
||||
register: ssh_keys_stat
|
||||
|
||||
- name: Update SSH keys if changed
|
||||
authorized_key:
|
||||
user: "{{ ansible_user }}"
|
||||
key: "{{ item }}"
|
||||
state: present
|
||||
loop: "{{ ssh_public_keys | default([]) }}"
|
||||
when: ssh_public_keys is defined
|
||||
tags: ['ssh-keys-update']
|
Reference in New Issue
Block a user