--- - name: root user password user: name: root password: "{{ root_password }}" when: root_password is defined - name: root user ssh key user: name: root generate_ssh_key: yes ssh_key_type: ed25519 when: root_ssh_key - name: root user ssh directory file: path: /root/.ssh state: directory mode: 0700 when: root_ssh_authorized_keys is defined - name: root user ssh authorized keys copy: content: "{{ root_ssh_authorized_keys | join('\n') }}" dest: /root/.ssh/authorized_keys when: root_ssh_authorized_keys is defined