From 276c9bd2a751f90911689a37e3a86f4a26056e23 Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Tue, 15 Sep 2026 16:29:29 -0400 Subject: automate adding new host flow --- nix/README.md | 17 ----------------- nix/generate-keys.sh | 3 +++ 2 files changed, 3 insertions(+), 17 deletions(-) (limited to 'nix') diff --git a/nix/README.md b/nix/README.md index 95cd4ac..920e9d3 100644 --- a/nix/README.md +++ b/nix/README.md @@ -28,25 +28,8 @@ Convert to Proxmox Template: ssh lan.hesh 'qm template 104' ``` -Run TF as usual using clone against the Template. -```sh -cd ../terraform -source con.env -tofu plan -out=tfplan -tofu apply tfplan -``` - ## Add Host -Scaffold a new host (host keys, `.sops.yaml`, `flake.nix`, `per-host/`, secrets, TF VM if absent, `~/.ssh/config`, Hosts section) and print the exact cmds to create the VM and deploy: -```sh -./add.sh # interactive for cpu/mem/disk/vlan -./add.sh --cpu 1 --mem 1024 --disk 10G --vlan 30 -``` - -Defaults for cpu/mem/disk/vlan are taken from `monitoring-2`. If the VM already exists in TF it is left alone. - -The manual equivalent, if needed: ```sh ./generate-keys.sh diff --git a/nix/generate-keys.sh b/nix/generate-keys.sh index 611d931..89484e7 100755 --- a/nix/generate-keys.sh +++ b/nix/generate-keys.sh @@ -2,6 +2,9 @@ # Generate a host key for a specific host set -euo pipefail +# Resolve paths relative to this script, not the caller's CWD +cd -- "$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")" + HOST="$1" mkdir -p "./host-keys/${HOST}" ssh-keygen -t ed25519 -f "./host-keys/${HOST}/ssh_host_ed25519_key" -N "" -- cgit v1.2.3