--- - name: add ssh keys to root ansible.posix.authorized_key: user: root key: "{{ lookup('file', '../../access/keys/' + item + '.pub') }}" state: present # Note: we don't remove other/existing keys with_items: "{{ ssh_root_keys }}"