Reload haproxy configuration as a post-deployment step
authorCarlos Camacho <ccamacho@redhat.com>
Fri, 4 Nov 2016 08:27:48 +0000 (09:27 +0100)
committerCarlos Camacho <ccamacho@redhat.com>
Tue, 8 Nov 2016 13:56:18 +0000 (13:56 +0000)
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

extraconfig/tasks/pacemaker_resource_restart.sh
overcloud-resource-registry-puppet.j2.yaml
puppet/post.j2.yaml

index 3da7efe..8500bce 100755 (executable)
@@ -4,11 +4,14 @@ set -eux
 
 # Run if pacemaker is running, we're the bootstrap node,
 # and we're updating the deployment (not creating).
-if [[ -n $(pcmk_running) && -n $(is_bootstrap_node) ]]; then
+
+RESTART_FOLDER="/var/lib/tripleo/pacemaker-restarts"
+
+if [[ -d "$RESTART_FOLDER" && -n $(pcmk_running) && -n $(is_bootstrap_node) ]]; then
 
     TIMEOUT=600
-    SERVICES_TO_RESTART="$(ls /var/lib/tripleo/pacemaker-restarts)"
     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
@@ -20,6 +23,12 @@ if [[ -n $(pcmk_running) && -n $(is_bootstrap_node) ]]; then
     for service in $SERVICES_TO_RESTART; do
         echo "Restarting $service..."
         pcs resource restart --wait=$TIMEOUT $service
-        rm -f /var/lib/tripleo/pacemaker-restarts/$service
+        rm -f "$RESTART_FOLDER"/$service
     done
+
+fi
+
+haproxy_status=$(systemctl is-active haproxy)
+if [ "$haproxy_status" = "active" ]; then
+    systemctl reload haproxy
 fi
index 980a718..f63d071 100644 (file)
@@ -57,6 +57,9 @@ resource_registry:
   OS::TripleO::NodeExtraConfig: puppet/extraconfig/pre_deploy/default.yaml
   OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/default.yaml
 
+  OS::TripleO::Tasks::ControllerPrePuppet: OS::Heat::None
+  OS::TripleO::Tasks::ControllerPostPuppet: OS::Heat::None
+
   # "AllNodes" Extra cluster config, runs on all nodes prior to the post_deploy
   # phase, e.g when puppet is applied, but after the pre_deploy phase.  Useful when
   # configuration with knowledge of all nodes in the cluster is required vs single
index 65c96ac..8218f41 100644 (file)
@@ -47,6 +47,15 @@ resources:
     properties:
       StepConfig: {get_param: [role_data, {{role.name}}, step_config]}
 
+  {% if role.name == 'Controller' %}
+  ControllerPrePuppet:
+    type: OS::TripleO::Tasks::ControllerPrePuppet
+    properties:
+      servers: {get_param: [servers, Controller]}
+      input_values:
+        update_identifier: {get_param: DeployIdentifier}
+  {% endif %}
+
   # Step through a series of configuration steps
   {{role.name}}Deployment_Step1:
     type: OS::Heat::StructuredDeploymentGroup
@@ -136,4 +145,16 @@ resources:
     type: OS::TripleO::NodeExtraConfigPost
     properties:
         servers: {get_param: [servers, {{role.name}}]}
+
+  {% if role.name == 'Controller' %}
+  ControllerPostPuppet:
+    depends_on:
+      - ControllerExtraConfigPost
+    type: OS::TripleO::Tasks::ControllerPostPuppet
+    properties:
+      servers: {get_param: [servers, Controller]}
+      input_values:
+        update_identifier: {get_param: DeployIdentifier}
+  {% endif %}
+
 {% endfor %}