Run early preflight before mutating up pipeline
This commit is contained in:
parent
b763e8c747
commit
28cb7ed70f
32
jeannie
32
jeannie
|
|
@ -1159,6 +1159,14 @@ check_edge_ssh() {
|
||||||
ssh -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "${edge_user}@${edge_host}" "true"
|
ssh -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "${edge_user}@${edge_host}" "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_rpi_ssh() {
|
||||||
|
local rpi_host="${LAB_RPI_HOST:-${LAB_RASPBERRY_HOST:-192.168.100.89}}"
|
||||||
|
local rpi_user="${LAB_RPI_USER:-${LAB_RASPBERRY_USER:-jv}}"
|
||||||
|
local rpi_key="${LAB_RPI_SSH_KEY_PATH:-${LAB_RASPBERRY_SSH_KEY_PATH:-/home/jv/.ssh/id_ed25519}}"
|
||||||
|
|
||||||
|
ssh -i "${rpi_key}" -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new "${rpi_user}@${rpi_host}" "true"
|
||||||
|
}
|
||||||
|
|
||||||
check_rpi_docker_root_state() {
|
check_rpi_docker_root_state() {
|
||||||
local rpi_host="${LAB_RPI_HOST:-${LAB_RASPBERRY_HOST:-192.168.100.89}}"
|
local rpi_host="${LAB_RPI_HOST:-${LAB_RASPBERRY_HOST:-192.168.100.89}}"
|
||||||
local rpi_user="${LAB_RPI_USER:-${LAB_RASPBERRY_USER:-jv}}"
|
local rpi_user="${LAB_RPI_USER:-${LAB_RASPBERRY_USER:-jv}}"
|
||||||
|
|
@ -1216,6 +1224,7 @@ sudo \"\$pvesm_cmd\" status | awk -v storage='${worker_storage}' 'NR > 1 && \$1
|
||||||
}
|
}
|
||||||
|
|
||||||
homelab_preflight() {
|
homelab_preflight() {
|
||||||
|
local phase="${1:-full}"
|
||||||
local failures=0
|
local failures=0
|
||||||
|
|
||||||
require_debian_server "preflight"
|
require_debian_server "preflight"
|
||||||
|
|
@ -1225,12 +1234,24 @@ homelab_preflight() {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running homelab preflight checks from ${HOMELAB_INVENTORY_FILE:-${REPO_ROOT}/homelab.yml}..."
|
case "${phase}" in
|
||||||
|
early | full)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported preflight phase '${phase}'." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "Running ${phase} homelab preflight checks from ${HOMELAB_INVENTORY_FILE:-${REPO_ROOT}/homelab.yml}..."
|
||||||
|
|
||||||
preflight_check "Gitea reachable at ${LAB_GITEA_LOCAL_URL:-http://${LAB_GITEA_HOST:-192.168.100.73}:${LAB_GITEA_HTTP_PORT:-3000}/}" check_gitea_reachable || failures=$((failures + 1))
|
|
||||||
preflight_check "Debian Docker root is ${LAB_DEBIAN_DOCKER_ROOT:-/var/lib/docker}" check_debian_docker_root || failures=$((failures + 1))
|
preflight_check "Debian Docker root is ${LAB_DEBIAN_DOCKER_ROOT:-/var/lib/docker}" check_debian_docker_root || failures=$((failures + 1))
|
||||||
preflight_check "Debian Tailscale IP ${LAB_DEBIAN_TAILSCALE_IP:-unset}" check_debian_tailscale_ip || failures=$((failures + 1))
|
preflight_check "Debian Tailscale IP ${LAB_DEBIAN_TAILSCALE_IP:-unset}" check_debian_tailscale_ip || failures=$((failures + 1))
|
||||||
preflight_check "RPi Docker root is NVMe or fallback" check_rpi_docker_root_state || failures=$((failures + 1))
|
preflight_check "RPi SSH ${LAB_RPI_USER:-${LAB_RASPBERRY_USER:-jv}}@${LAB_RPI_HOST:-${LAB_RASPBERRY_HOST:-192.168.100.89}}" check_rpi_ssh || failures=$((failures + 1))
|
||||||
|
if [[ "${phase}" == "full" ]]; then
|
||||||
|
preflight_check "Gitea reachable at ${LAB_GITEA_LOCAL_URL:-http://${LAB_GITEA_HOST:-192.168.100.73}:${LAB_GITEA_HTTP_PORT:-3000}/}" check_gitea_reachable || failures=$((failures + 1))
|
||||||
|
preflight_check "RPi Docker root is NVMe or fallback" check_rpi_docker_root_state || failures=$((failures + 1))
|
||||||
|
fi
|
||||||
preflight_warn "RPi Tailscale IP ${LAB_RPI_TAILSCALE_IP:-unset}" check_rpi_tailscale_ip
|
preflight_warn "RPi Tailscale IP ${LAB_RPI_TAILSCALE_IP:-unset}" check_rpi_tailscale_ip
|
||||||
preflight_check "Pimox storage ${LAB_PIMOX_WORKER_STORAGE:-${TF_VAR_pimox_worker_storage:-opi5_ssd}} is active" check_pimox_storage || failures=$((failures + 1))
|
preflight_check "Pimox storage ${LAB_PIMOX_WORKER_STORAGE:-${TF_VAR_pimox_worker_storage:-opi5_ssd}} is active" check_pimox_storage || failures=$((failures + 1))
|
||||||
preflight_check "OCI edge SSH ${LAB_EDGE_USER:-ubuntu}@${LAB_EDGE_HOST:-132.145.170.74}" check_edge_ssh || failures=$((failures + 1))
|
preflight_check "OCI edge SSH ${LAB_EDGE_USER:-ubuntu}@${LAB_EDGE_HOST:-132.145.170.74}" check_edge_ssh || failures=$((failures + 1))
|
||||||
|
|
@ -1240,7 +1261,7 @@ homelab_preflight() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Preflight checks passed."
|
echo "${phase^} preflight checks passed."
|
||||||
}
|
}
|
||||||
|
|
||||||
run_pimox_pipeline() {
|
run_pimox_pipeline() {
|
||||||
|
|
@ -3780,10 +3801,11 @@ up() {
|
||||||
|
|
||||||
echo "Deploying the homelab infrastructure..."
|
echo "Deploying the homelab infrastructure..."
|
||||||
|
|
||||||
|
homelab_preflight early
|
||||||
deploy_gitea
|
deploy_gitea
|
||||||
bootstrap_gitea_repo
|
bootstrap_gitea_repo
|
||||||
deploy_rpi_services
|
deploy_rpi_services
|
||||||
homelab_preflight
|
homelab_preflight full
|
||||||
run_pimox_pipeline
|
run_pimox_pipeline
|
||||||
run_openwrt_pipeline
|
run_openwrt_pipeline
|
||||||
if [[ -z "${LAB_CLUSTER_VAR_FILE:-}" ]]; then
|
if [[ -z "${LAB_CLUSTER_VAR_FILE:-}" ]]; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue