tripleo-heat-templates/extraconfig/tasks/pacemaker_resource_restart.sh
Carlos Camacho 17e727d716 Reload haproxy configuration as a post-deployment step
After deploying a fresh installed Overcloud or updating the stack
the haproxy configuration is updated correctly but no change in the
HA proxy stats happens.

This submission will add the missing resources to run pre and post
puppet tasks.

Closes-bug: 1640175

Change-Id: I2f08704daeee502c618256695a30ce244a1d7ba5
2016-11-08 13:56:18 +00:00

35 lines
922 B
Bash
Executable File

#!/bin/bash
set -eux
# Run if pacemaker is running, we're the bootstrap node,
# and we're updating the deployment (not creating).
RESTART_FOLDER="/var/lib/tripleo/pacemaker-restarts"
if [[ -d "$RESTART_FOLDER" && -n $(pcmk_running) && -n $(is_bootstrap_node) ]]; then
TIMEOUT=600
PCS_STATUS_OUTPUT="$(pcs status)"
SERVICES_TO_RESTART="$(ls $RESTART_FOLDER)"
for service in $SERVICES_TO_RESTART; do
if ! echo "$PCS_STATUS_OUTPUT" | grep $service; then
echo "Service $service not found as a pacemaker resource, cannot restart it."
exit 1
fi
done
for service in $SERVICES_TO_RESTART; do
echo "Restarting $service..."
pcs resource restart --wait=$TIMEOUT $service
rm -f "$RESTART_FOLDER"/$service
done
fi
haproxy_status=$(systemctl is-active haproxy)
if [ "$haproxy_status" = "active" ]; then
systemctl reload haproxy
fi