infra/terraform/deploy_talos_node.sh
2026-01-11 11:27:34 -06:00

44 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
# Script to deploy Talos nodes one at a time for DHCP static lease configuration
set -e
NODE=$1
if [ -z "$NODE" ]; then
echo "Usage: $0 <node_name>"
echo ""
echo "Available nodes:"
echo " talos_cp1 - Control Plane 1 (node1)"
echo " talos_cp2 - Control Plane 2 (node2)"
echo " talos_cp3 - Control Plane 3 (node3)"
echo " talos_worker1 - Worker 1 (node1)"
echo " talos_worker2 - Worker 2 (node2)"
echo " talos_worker3 - Worker 3 (node3)"
echo ""
echo "Example: $0 talos_cp1"
exit 1
fi
# Source environment variables
if [ -f .envrc ]; then
source .envrc
fi
echo "=== Deploying $NODE ==="
echo ""
# Apply only the targeted node
tofu apply -target="proxmox_virtual_environment_vm.$NODE"
echo ""
echo "=== VM Created - MAC Address ==="
tofu output "${NODE}_mac"
echo ""
echo "Next steps:"
echo "1. Note the MAC address above"
echo "2. Configure DHCP static lease for this MAC"
echo "3. Start the VM if not auto-started"
echo "4. Verify the VM gets the correct IP"
echo "5. Run this script again with the next node"