Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Improve decommission process_2 #435

Merged
merged 8 commits into from
Feb 24, 2024
Merged

Conversation

McSim85
Copy link
Contributor

@McSim85 McSim85 commented Feb 17, 2024

Often, when I run the role with state: absent, the next role run with state: present will fail with different errors. For example, like described in the bug
#429

After talking to Tailscale support, that issue might happen if /var/lib/tailscale/ still contains the previous machine identity (state, auth key, id, etc).

We have to remove this folder during decommission.
Fortunately, Ubuntu package has that task inside the tailscale.postrm, (if the user rune apt purge tailscale):

$ cat /var/lib/dpkg/info/tailscale.postrm
#!/bin/sh
set -e
if [ -d /run/systemd/system ] ; then
	systemctl --system daemon-reload >/dev/null || true
fi

if [ -x "/usr/bin/deb-systemd-helper" ]; then
    if [ "$1" = "remove" ]; then
		deb-systemd-helper mask 'tailscaled.service' >/dev/null || true
	fi

    if [ "$1" = "purge" ]; then
		deb-systemd-helper purge 'tailscaled.service' >/dev/null || true
		deb-systemd-helper unmask 'tailscaled.service' >/dev/null || true
		rm -rf /var/lib/tailscale
	fi
fi

So, this is the best way to handle tailscale state removal - purge: true, because this will always be aligned with the package maintainers config.

I am not sure about other distros, though.
Probably, we need a task like this in each distro subtree:

- name: Uninstall | Delete Tailscale Package State
  ansible.builtin.file:
    path: "/var/lib/tailscale"
    state: absent

@artis3n ,
As we discussed here
#430 (comment)
I removed variable from the code.
Please let me know how do you prefer to handle this or if you need any help?

P.S. This is part of
#430

@artis3n
Copy link
Owner

artis3n commented Feb 24, 2024

Can't reproduce the failing ghcr.io/artis3n/docker-opensuse-tumbleweed-ansible:latest test locally, seems like a blip.

@artis3n artis3n merged commit 97503d6 into artis3n:main Feb 24, 2024
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants