From 0b5bf06b3571b8f1721f1285c2e88dc1faa32ad4 Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Wed, 28 Oct 2026 22:07:26 -0600 Subject: [PATCH] Fail edge bootstrap fast on Bastion SSH preflight --- bootstrap/edge/main.tf | 1 + bootstrap/edge/variables.tf | 6 ++++++ lib/jeannie/pipeline.sh | 9 ++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/bootstrap/edge/main.tf b/bootstrap/edge/main.tf index 8889e6c..2f3e9ce 100644 --- a/bootstrap/edge/main.tf +++ b/bootstrap/edge/main.tf @@ -131,6 +131,7 @@ resource "null_resource" "edge_services" { bastion_user = var.edge_bastion_user != "" ? var.edge_bastion_user : null bastion_port = var.edge_bastion_port bastion_private_key = var.edge_bastion_private_key_path != "" ? file(var.edge_bastion_private_key_path) : null + timeout = var.edge_ssh_timeout } provisioner "remote-exec" { diff --git a/bootstrap/edge/variables.tf b/bootstrap/edge/variables.tf index 25b20b4..20306a9 100644 --- a/bootstrap/edge/variables.tf +++ b/bootstrap/edge/variables.tf @@ -48,6 +48,12 @@ variable "edge_bastion_private_key_path" { default = "" } +variable "edge_ssh_timeout" { + description = "Maximum time OpenTofu may spend connecting to the edge SSH endpoint." + type = string + default = "45s" +} + variable "edge_install_dir" { type = string default = "/opt/homelab-edge" diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 95225c2..fc2d410 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -717,7 +717,7 @@ run_tofu_stack() { ensure_cluster_worker_var_file fi if [[ "${stack}" == "bootstrap/edge" ]]; then - ensure_edge_tailscale_routes + ensure_edge_tailscale_routes || return 1 ensure_edge_haproxy_stats_password fi if truthy "${auto_approve}"; then @@ -8664,13 +8664,16 @@ sudo tailscale set --advertise-routes='${route}' esac edge_ssh_args - ssh "${EDGE_SSH_ARGS[@]}" "${edge_user}@${edge_host}" "set -eu + if ! ssh "${EDGE_SSH_ARGS[@]}" "${edge_user}@${edge_host}" "set -eu if ! command -v tailscale >/dev/null 2>&1; then echo 'tailscale is not installed on the OCI edge host.' >&2 exit 1 fi sudo tailscale set --accept-routes=true -" +"; then + echo "OCI edge SSH preflight failed via Bastion (${edge_host})." >&2 + return 1 + fi } edge_haproxy_stats_credentials_file() {