diff --git a/ansible/roles/tailscale-cleanup/tasks/main.yml b/ansible/roles/tailscale-cleanup/tasks/main.yml index dee39f4..2f42698 100644 --- a/ansible/roles/tailscale-cleanup/tasks/main.yml +++ b/ansible/roles/tailscale-cleanup/tasks/main.yml @@ -16,7 +16,14 @@ {{ ts_devices.json.devices | default([]) | selectattr('hostname', 'defined') | selectattr('hostname', 'in', tailscale_reserved_hostnames) - | rejectattr('online', 'true') + | rejectattr('online', 'defined') + | list + + + ts_devices.json.devices | default([]) + | selectattr('hostname', 'defined') + | selectattr('hostname', 'in', tailscale_reserved_hostnames) + | selectattr('online', 'defined') + | rejectattr('online', 'equalto', true) | list }} - name: Delete stale devices