Add congenital-optimist support to lab tool
- Add congenital-optimist as local deployment target - Use direct nixos-rebuild for local deployment (no SSH) - Update all machine arrays and help text to include 4th machine - Optimize deployment handling for local vs remote machines
This commit is contained in:
parent
7ac9c0fc98
commit
b781252847
1 changed files with 24 additions and 9 deletions
|
@ -41,6 +41,20 @@ writeShellScriptBin "lab" ''
|
||||||
local mode="''${2:-boot}" # boot, test, or switch
|
local mode="''${2:-boot}" # boot, test, or switch
|
||||||
|
|
||||||
case "$machine" in
|
case "$machine" in
|
||||||
|
"congenital-optimist")
|
||||||
|
# Local deployment - no SSH needed
|
||||||
|
log "Deploying $machine (mode: $mode) locally"
|
||||||
|
|
||||||
|
# Deploy the configuration locally
|
||||||
|
log "Running nixos-rebuild $mode locally..."
|
||||||
|
if ! sudo nixos-rebuild $mode --flake "$HOMELAB_ROOT#$machine"; then
|
||||||
|
error "Failed to deploy configuration to $machine"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
success "Successfully deployed $machine"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
"sleeper-service")
|
"sleeper-service")
|
||||||
local target_host="sma@sleeper-service"
|
local target_host="sma@sleeper-service"
|
||||||
;;
|
;;
|
||||||
|
@ -52,7 +66,7 @@ writeShellScriptBin "lab" ''
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error "Unknown machine: $machine"
|
error "Unknown machine: $machine"
|
||||||
error "Available machines: sleeper-service, grey-area, reverse-proxy"
|
error "Available machines: congenital-optimist, sleeper-service, grey-area, reverse-proxy"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -79,7 +93,7 @@ writeShellScriptBin "lab" ''
|
||||||
# Update all machines function
|
# Update all machines function
|
||||||
update_all_machines() {
|
update_all_machines() {
|
||||||
local mode="''${1:-boot}" # boot, test, or switch
|
local mode="''${1:-boot}" # boot, test, or switch
|
||||||
local machines=("sleeper-service" "grey-area" "reverse-proxy")
|
local machines=("congenital-optimist" "sleeper-service" "grey-area" "reverse-proxy")
|
||||||
local failed_machines=()
|
local failed_machines=()
|
||||||
|
|
||||||
log "Starting update of all machines (mode: $mode)"
|
log "Starting update of all machines (mode: $mode)"
|
||||||
|
@ -129,7 +143,7 @@ writeShellScriptBin "lab" ''
|
||||||
"deploy")
|
"deploy")
|
||||||
if [[ $# -lt 2 ]]; then
|
if [[ $# -lt 2 ]]; then
|
||||||
error "Usage: lab deploy <machine> [mode]"
|
error "Usage: lab deploy <machine> [mode]"
|
||||||
error "Machines: sleeper-service, grey-area, reverse-proxy"
|
error "Machines: congenital-optimist, sleeper-service, grey-area, reverse-proxy"
|
||||||
error "Modes: boot (default), test, switch"
|
error "Modes: boot (default), test, switch"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -167,18 +181,19 @@ writeShellScriptBin "lab" ''
|
||||||
echo ""
|
echo ""
|
||||||
echo "Available commands:"
|
echo "Available commands:"
|
||||||
echo " deploy <machine> [mode] - Deploy configuration to a machine"
|
echo " deploy <machine> [mode] - Deploy configuration to a machine"
|
||||||
echo " Machines: sleeper-service, grey-area, reverse-proxy"
|
echo " Machines: congenital-optimist, sleeper-service, grey-area, reverse-proxy"
|
||||||
echo " Modes: boot (default), test, switch"
|
echo " Modes: boot (default), test, switch"
|
||||||
echo " update [mode] - Update all machines"
|
echo " update [mode] - Update all machines"
|
||||||
echo " Modes: boot (default), test, switch"
|
echo " Modes: boot (default), test, switch"
|
||||||
echo " status - Check infrastructure connectivity"
|
echo " status - Check infrastructure connectivity"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo " lab deploy sleeper-service boot # Deploy and set for next boot"
|
echo " lab deploy congenital-optimist boot # Deploy workstation for next boot"
|
||||||
echo " lab deploy grey-area switch # Deploy and switch immediately"
|
echo " lab deploy sleeper-service boot # Deploy and set for next boot"
|
||||||
echo " lab update boot # Update all machines for next boot"
|
echo " lab deploy grey-area switch # Deploy and switch immediately"
|
||||||
echo " lab update switch # Update all machines immediately"
|
echo " lab update boot # Update all machines for next boot"
|
||||||
echo " lab status # Check all machines"
|
echo " lab update switch # Update all machines immediately"
|
||||||
|
echo " lab status # Check all machines"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
''
|
''
|
Loading…
Add table
Add a link
Reference in a new issue