--- - name: Install the ssh keys for the authorized users authorized_key: user=root key="{{ item }}" state=present with_items: '{{ root_ssh_keys | default([]) }}' when: manage_root_ssh_keys tags: [ 'pubkeys', 'ssh_keys' ] - name: Remove obsolete ssh keys if there are any authorized_key: user=root key="{{ item }}" state=absent with_items: '{{ obsolete_root_ssh_keys | default([]) }}' when: obsolete_ssh_key is defined tags: [ 'pubkeys', 'ssh_keys' ]