Skip to content

Commit

Permalink
include Tailscale is stopped. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
McSim85 authored Dec 12, 2024
2 parents cfbc0bf + fd06339 commit 3fd336a
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion tasks/uninstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,53 @@
failed_when: false
register: tailscale_status

- name: Uninstall | Add debug message
ansible.builtin.debug:
msg: "{{ tailscale_status }}"

- name: Uninstall | Run tailscale bugreport before logout
ansible.builtin.command: tailscale bugreport
changed_when: false
failed_when: false
register: tailscale_bugreport

- name: Uninstall | Add debug message
ansible.builtin.debug:
msg: "{{ tailscale_bugreport }}"

- name: Uninstall | List content of /var/lib/tailscale
ansible.builtin.command: ls -la /var/lib/tailscale
changed_when: false
failed_when: false
register: tailscale_lib_dir

- name: Uninstall | Add debug message
ansible.builtin.debug:
msg: "{{ tailscale_lib_dir }}"

- name: Uninstall | Gather tailscale version
ansible.builtin.command: tailscale version
changed_when: false
failed_when: false
register: tailscale_version

- name: Uninstall | Add debug message
ansible.builtin.debug:
msg: "{{ tailscale_version }}"

- name: Uninstall | De-register Tailscale Node
become: true
# Hack to get correct changed/ok status
ansible.builtin.shell: tailscale status; tailscale logout
ansible.builtin.shell: tailscale status; tailscale logout ; tailscale bugreport
register: tailscale_logout
changed_when: "'Logged out.' not in tailscale_status.stdout and 'not logged in' not in tailscale_status.stdout"
when:
# [Errno 2] No such file or directory: 'tailscale'
- tailscale_status.rc != 2
# "bash: tailscale: command not found"
- tailscale_status.rc != 127
# "Tailscale is stopped."
- tailscale_status.rc != 1

- name: Uninstall | Delete Tailscale State
ansible.builtin.file:
Expand Down

0 comments on commit 3fd336a

Please sign in to comment.