- name: Add ssh key to ubuntu user hosts: nodes tasks: - name: Set authorized key took from file authorized_key: user: ubuntu state: present key: "{{ lookup('file', '/root/.ssh/id_ed25519.pub') }}"