#!/bin/bash # shellcheck disable=SC1091 source "${AGENT_PATH}/common.sh" _check_required_env_vars "CONTAINER_NAME" "STATE_VOLUME" # Tailscale Destroy Script - Complete removal including data echo "WARNING: This will completely remove Tailscale and all its data!" echo "This includes the Tailscale state and authentication." echo "" read -p "Are you sure you want to continue? (yes/no): " confirmation if [ "$confirmation" != "yes" ]; then echo "Destruction cancelled." exit 0 fi echo "" echo "Destroying Tailscale service and data..." # First run uninstall ${SERVICE_PATH}/uninstall.sh # Remove the state volume echo "Removing Tailscale state volume..." if docker volume ls | grep -q ${STATE_VOLUME}; then docker volume rm ${STATE_VOLUME} || echo "Warning: Could not remove volume ${STATE_VOLUME}" else echo "Volume ${STATE_VOLUME} does not exist." fi echo "" echo "Tailscale has been completely destroyed." echo "Note: You should also remove this node from your Tailscale admin console at:" echo " https://login.tailscale.com/admin/machines"