Update create_user_ssh/check_authorizzed_key.yml
This commit is contained in:
parent
b72d005b96
commit
8678290e6b
|
@ -23,4 +23,10 @@
|
||||||
user: root # Replace with the remote user's name
|
user: root # Replace with the remote user's name
|
||||||
state: present
|
state: present
|
||||||
key: "{{ key_to_add }}"
|
key: "{{ key_to_add }}"
|
||||||
when: authorized_key_exists | default(false) | not
|
|
||||||
|
rescue:
|
||||||
|
- name: Handle error when key already exists
|
||||||
|
debug:
|
||||||
|
msg: "The authorized key already exists. Skipping addition."
|
||||||
|
|
||||||
|
when: not authorized_key_exists | default(false)
|
Loading…
Reference in New Issue