--- - name: ssh key user: name: root generate_ssh_key: yes ssh_key_type: ed25519 when: root_ssh_key - name: ssh authorized keys template: src: ssh_authorized_keys.j2 dest: /root/.ssh/authorized_keys when: root_ssh_authorized_keys is defined