We have a number of VM’s running on AWS. The VM’s are configured entirely by a script that runs on startup. If an issue is detected, or we have to make a major change to a system, the VM is destroyed and setup again. A disk is attached that’s persistent and stores all the data along with any sort of persistent configuration files like SSL certs, Docker stuff, so on.
When the server reloads it comes up with a new machine name (expected). To deal with this I moved the Tailscale data folder that contains the tailscale.state file to the persistent drive and altered the tailscale.service file to point to this location instead. For example
ExecStart=/usr/sbin/tailscaled --state=/opt/etl/tailscale/tailscaled.state --socket=/run/tailscale/tailscaled.sock --port $PORT $FLAGS
The service is then started with an authkey. I had hoped keeping this state file would mean that the machine name would update, but it just creates a new device in the Tailscale portal. Does anyone have any insight on how I could accomplish this?