--- - name: Set authorized keys authorized_key: user: "{{ main_user }}" key: "{{ lookup('file', 'public_keys.pub') }}" state: present exclusive: true # removing all the authorized keys already set