Fail edge bootstrap fast on Bastion SSH preflight
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-10-28 22:07:26 -06:00
parent 8584355afc
commit 0b5bf06b35
3 changed files with 13 additions and 3 deletions

View File

@ -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" {

View File

@ -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"

View File

@ -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() {