--- - name: Uninstall Nebula completely hosts: all gather_facts: no become: yes tasks: - name: Stop and disable lighthouse service systemd: name: lighthouse state: stopped enabled: no daemon_reload: yes when: inventory_hostname in groups['nebula_lighthouse'] ignore_errors: yes - name: Stop and disable nebula service systemd: name: nebula state: stopped enabled: no daemon_reload: yes when: inventory_hostname not in groups['nebula_lighthouse'] ignore_errors: yes - name: Remove lighthouse systemd unit file: path: /etc/systemd/system/lighthouse.service state: absent when: inventory_hostname in groups['nebula_lighthouse'] - name: Remove nebula systemd unit file: path: /etc/systemd/system/nebula.service state: absent when: inventory_hostname not in groups['nebula_lighthouse'] - name: Reload systemd after unit removal systemd: daemon_reload: yes - name: Remove nebula-check cron job cron: name: "nebula-check" state: absent - name: Remove /opt/nebula directory (binaries, certs, keys, config) file: path: /opt/nebula state: absent - name: Remove .neb entries from /etc/hosts replace: path: /etc/hosts regexp: '^.+\.neb\n' replace: '' backup: yes