mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-04 15:47:32 +02:00
Update to 2021-12-13 19:00
This commit is contained in:
13
roles/ssh/tasks/cleanup.yml
Normal file
13
roles/ssh/tasks/cleanup.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
- name: List all authorized keys directories
|
||||
shell: ls -1 /etc/ssh/authorized_keys | xargs -n1 basename
|
||||
register: existing_ssh_keys
|
||||
changed_when: False
|
||||
tags: ssh
|
||||
|
||||
- name: Remove unmanaged ssh keys
|
||||
file: path=/etc/ssh/authorized_keys/{{ item }} state=absent
|
||||
loop: "{{ existing_ssh_keys.stdout_lines | default([]) }}"
|
||||
when: item not in ssh_users | rejectattr('keys_file', 'defined') | map(attribute='name')
|
||||
tags: ssh
|
Reference in New Issue
Block a user