Update deploy-proxmox-keepalived.sh

This commit is contained in:
David Schroeder
2026-07-25 09:35:05 -05:00
parent cb954f6f22
commit 3512472551
+10 -6
View File
@@ -3,9 +3,9 @@ set -Eeuo pipefail
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Proxmox cluster Keepalived deployment # Proxmox cluster Keepalived deployment
# Version 1.5.0 # Version 1.5.2
# #
# - Discovers cluster members with `pvecm nodes` # - Discovers real Proxmox cluster members from /etc/pve/.members (QDevice-safe)
# - Prompts for the floating VIP/CIDR unless supplied on the command line # - Prompts for the floating VIP/CIDR unless supplied on the command line
# - Discovers local Linux bridges and prompts the user to select one unless # - Discovers local Linux bridges and prompts the user to select one unless
# supplied on the command line # supplied on the command line
@@ -21,7 +21,7 @@ set -Eeuo pipefail
# Run this from any healthy, quorate Proxmox cluster node as root. # Run this from any healthy, quorate Proxmox cluster node as root.
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
SCRIPT_VERSION="1.5.1" SCRIPT_VERSION="1.5.2"
VIP_CIDR="" VIP_CIDR=""
INTERFACE="" INTERFACE=""
PRIORITY_BASE=200 PRIORITY_BASE=200
@@ -545,7 +545,11 @@ HEALTH
# Test the staged script before touching the live health-check path. This is # Test the staged script before touching the live health-check path. This is
# important on a redeploy: an already-running Keepalived instance may be # important on a redeploy: an already-running Keepalived instance may be
# executing the live script every few seconds. # executing the live script every few seconds.
remote_exec "$node" "$remote_health" \ # /run is commonly mounted noexec on hardened systems. Execute the staged
# script through Bash so preflight validation works even when the staging
# filesystem itself does not permit execve(2). The final installed script is
# still executed directly from /usr/local/sbin by Keepalived.
remote_exec "$node" "bash '$remote_health'" \
|| die "Staged health check failed on ${node}. No live Keepalived files have been replaced." || die "Staged health check failed on ${node}. No live Keepalived files have been replaced."
config_file="$TMPDIR/keepalived-${node}.conf" config_file="$TMPDIR/keepalived-${node}.conf"
@@ -651,7 +655,7 @@ done
log "Installing validated health checks on all nodes." log "Installing validated health checks on all nodes."
for node in "${NODES[@]}"; do for node in "${NODES[@]}"; do
remote_exec "$node" \ remote_exec "$node" \
"if [[ -f /usr/local/sbin/check-proxmox-keepalived.sh ]]; then cp -a /usr/local/sbin/check-proxmox-keepalived.sh /usr/local/sbin/check-proxmox-keepalived.sh.pre-proxmox-vip.${DEPLOY_TAG}; fi; install -o root -g root -m 0750 '$STAGE_DIR/check-proxmox-keepalived.sh' /usr/local/sbin/check-proxmox-keepalived.sh" \ "if [ -f /usr/local/sbin/check-proxmox-keepalived.sh ]; then cp -a /usr/local/sbin/check-proxmox-keepalived.sh /usr/local/sbin/check-proxmox-keepalived.sh.pre-proxmox-vip.${DEPLOY_TAG}; fi; install -o root -g root -m 0750 '$STAGE_DIR/check-proxmox-keepalived.sh' /usr/local/sbin/check-proxmox-keepalived.sh" \
|| activation_die "Failed to install the health check on ${node}." || activation_die "Failed to install the health check on ${node}."
done done
@@ -666,7 +670,7 @@ done
log "Installing validated Keepalived configs on all nodes." log "Installing validated Keepalived configs on all nodes."
for node in "${NODES[@]}"; do for node in "${NODES[@]}"; do
remote_exec "$node" \ remote_exec "$node" \
"if [[ -f /etc/keepalived/keepalived.conf ]]; then cp -a /etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf.pre-proxmox-vip.${DEPLOY_TAG}; fi; install -o root -g root -m 0644 '$STAGE_DIR/keepalived.conf' /etc/keepalived/keepalived.conf; systemctl enable keepalived >/dev/null" \ "if [ -f /etc/keepalived/keepalived.conf ]; then cp -a /etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf.pre-proxmox-vip.${DEPLOY_TAG}; fi; install -o root -g root -m 0644 '$STAGE_DIR/keepalived.conf' /etc/keepalived/keepalived.conf; systemctl enable keepalived >/dev/null" \
|| activation_die "Failed to install the Keepalived configuration on ${node}." || activation_die "Failed to install the Keepalived configuration on ${node}."
done done