diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 8fef509..14620c9 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -7976,6 +7976,7 @@ edge_apply() { export TF_VAR_edge_ssh_key_path="${configured_edge_key}" fi refresh_oci_edge_endpoint + refresh_oci_edge_host_key run_tofu_stack "bootstrap/edge" local edge_host="${TF_VAR_edge_host:-${LAB_EDGE_HOST:-}}" @@ -8014,6 +8015,21 @@ refresh_oci_edge_endpoint() { fi } +refresh_oci_edge_host_key() { + local edge_host="${LAB_EDGE_HOST:-${TF_VAR_edge_host:-}}" + local known_hosts="${HOME}/.ssh/known_hosts" + + # OCI instances may be destroyed and recreated with the same public IP. + # Remove only the managed OCI edge address so accept-new can record the + # replacement fingerprint; unrelated homelab host keys remain untouched. + if [[ -z "${edge_host}" || "${LAB_OCI_FOUNDATION_ENABLED:-false}" != "true" ]]; then + return 0 + fi + if [[ -f "${known_hosts}" ]] && command -v ssh-keygen >/dev/null 2>&1; then + ssh-keygen -R "${edge_host}" -f "${known_hosts}" >/dev/null 2>&1 || true + fi +} + edge_flush_caches() { local edge_host="${TF_VAR_edge_host:-${LAB_EDGE_HOST:-}}" local edge_user="${TF_VAR_edge_user:-${LAB_EDGE_USER:-ubuntu}}"