Update create_user_ssh/check_authorizzed_key.yml

This commit is contained in:
David Lopez 2023-07-27 09:13:19 +00:00
parent 8678290e6b
commit e7fe212fba
1 changed files with 8 additions and 7 deletions

View File

@ -18,12 +18,13 @@
debug: debug:
msg: "Authorized key exists: {{ authorized_key_exists | default(false) }}" msg: "Authorized key exists: {{ authorized_key_exists | default(false) }}"
- name: Add authorized key if it does not exist
block:
- name: Add authorized key - name: Add authorized key
authorized_key: authorized_key:
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 }}"
rescue: rescue:
- name: Handle error when key already exists - name: Handle error when key already exists
debug: debug: