Backup authorized keys before nuking
This commit is contained in:
parent
752a9de6df
commit
d38e3ba4e0
@ -32,7 +32,7 @@
|
|||||||
dest: "{{ inventory_hostname }}/lsblk.out"
|
dest: "{{ inventory_hostname }}/lsblk.out"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
become: no
|
become: no
|
||||||
|
|
||||||
- name: Collect netstat
|
- name: Collect netstat
|
||||||
block:
|
block:
|
||||||
- name: Run command
|
- name: Run command
|
||||||
@ -65,6 +65,13 @@
|
|||||||
become: yes
|
become: yes
|
||||||
register: users_list
|
register: users_list
|
||||||
|
|
||||||
|
- name: Backup all users authorized keys
|
||||||
|
fetch:
|
||||||
|
src: "{{item['dir']}}/.ssh/authorized_keys"
|
||||||
|
dest: "{{ inventory_hostname }}"
|
||||||
|
ignore_errors: yes
|
||||||
|
loop: "{{ users_list.users }}"
|
||||||
|
|
||||||
- name: Give root exclusively the current controller user's SSH key
|
- name: Give root exclusively the current controller user's SSH key
|
||||||
ansible.posix.authorized_key:
|
ansible.posix.authorized_key:
|
||||||
user: root
|
user: root
|
||||||
|
Loading…
Reference in New Issue
Block a user