From d30e9bcc067c432fe93519dc5971ea98866a10cb Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Tue, 23 Aug 2016 11:37:28 +0300 Subject: Reload HAProxy on refresh If the configuration for the HAProxy class or any of the frontend endpoints has changed, we explicitly execute a reload on HA setups. This is useful since on updates of HA setups we set pacemaker on maintenance mode, and thus we are unable to refresh HAProxy's configuration; The aforementioned detail is problematic, since some puppet configurations rely on HAProxy taking into account the configuration. An example of this is changing a port in the endpoint map or enabling SSL. Change-Id: I7f26257fb43146afebca928f5498ee2174178063 --- manifests/profile/base/haproxy.pp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'manifests/profile/base/haproxy.pp') diff --git a/manifests/profile/base/haproxy.pp b/manifests/profile/base/haproxy.pp index 4f2f850..68ff3e4 100644 --- a/manifests/profile/base/haproxy.pp +++ b/manifests/profile/base/haproxy.pp @@ -82,6 +82,20 @@ class tripleo::profile::base::haproxy ( } include ::tripleo::haproxy + + unless hiera('tripleo::haproxy::haproxy_service_manage', true) { + # Reload HAProxy configuration if the haproxy class has refreshed or any + # HAProxy frontend endpoint has changed. + exec { 'haproxy-reload': + command => 'systemctl reload haproxy', + path => ['/usr/bin', '/usr/sbin'], + refreshonly => true, + onlyif => 'pcs property | grep -q "maintenance-mode.*true"', + subscribe => Class['::haproxy'] + } + Haproxy::Listen<||> ~> Exec['haproxy-reload'] + Haproxy::Balancermember<||> ~> Exec['haproxy-reload'] + } } } -- cgit 1.2.3-korg