--- - name: Add public keys for 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: "{{ global_ssh_keys + (ssh_keys['root'] | default([])) }}"