---
- name: set authorized keys for root
  authorized_key:
    state: present
    user: root
    key: "{{ ssh_authorized_keys|join('\n') }}"
    exclusive: yes

---
- name: set authorized keys for root
  authorized_key:
    state: present
    user: root
    key: "{{ ssh_authorized_keys|join('\n') }}"
    exclusive: yes
  when: ssh_authorized_keys is defined

Check that ssh_authorized_keys is defined
ssh_authorized_keys: Check that ssh_authorized_keys is defined
