tailscale

Tags: secrets, tailscale Secrets needed: Yes (only to join — once connected, BW is not required) Runs on: All machines

Installs Tailscale, fetches a reusable auth key from BW, joins the network, configures DNS, and keeps device hostname + advertised routes in sync.

What it does

  1. Configures systemd-resolved so MagicDNS works (link /etc/resolv.conf to the stub resolver, drop in DNSStubListenerExtra=::1 for container DNS).
  2. Sets net.ipv4.conf.{all,default}.rp_filter=2 and IP forwarding on, so exit-node and subnet-router traffic actually routes.
  3. If tailscale status reports connected → updates hostname, prefs, operator, systray, then exits the role.
  4. If not connected and the vault is unlocked → fetches tailscale-apikey from BW, deletes any stale device with this hostname via the Tailscale API, then tailscale up --authkey ….
  5. If not connected and the vault is locked → emits a one-line warning and ends the role. Joining without a key would either fail noisily or, worse, succeed with an empty key.

Failure modes

SymptomCauseFix
Role aborts with "vault locked" warning, host is not on tailnetFirst-time apply on this host without BW unlockedUnlock BW (`bw unlock --raw
Tailscale connected but MagicDNS names don't resolvesystemd-resolved link to /etc/resolv.conf was overwritten by NetworkManager / DHCP clientThe role re-applies it; just re-run dots-apply. To make it sticky, check network-manager settings (Bluefin does this correctly out of the box)
Duplicate device entries in admin console after rebuildAPI-key device cleanup didn't run (vault locked at the time)Manually delete in tailscale admin console or unlock vault and re-apply
Joins but no routes advertisedtailscale_advertise_routes not set in host_varsAdd it: tailscale_advertise_routes: "<lan-cidr>"

How to verify

tailscale status                # should show all fleet machines as peers
tailscale ip -4                 # this host's 100.x.x.x
host bihar.manatee-basking.ts.net   # MagicDNS resolves to a 100.x.x.x

Notes

  • All fleet machines are on the manatee-basking.ts.net tailnet.
  • The auth key is reusable — new machines join without re-authentication.
  • The Tailscale API key (tailscale-apikey in BW) is the same item used for joining and for device cleanup; rotate by editing the BW item and re-running this role on each host.