From ae99efd64c367108075df6930f9a66b3c979b8e6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Thu, 14 Apr 2016 17:14:19 +0100 Subject: [PATCH] Adding modularity to keepalived configuration This patch introduces modularity into the default keepalived configuration: Currently, keepalived uses a ping to check its alive status. The IP was hard setted in the configuration file. This patch introduces multiple variables: - keepalived_ping_address - keepalived_ping_count - keepalived_ping_interval The one probably used the most will be the ``keepalived_ping_address``. It's therefore listed in ``user_variables`` with the other keepalived variables. Fixes-Bug: #1570420 Change-Id: Ic9a591fe739dd4ee3b0ad0130190e000404fb73a --- .../install-guide/configure-haproxy.rst | 22 ++++++++++++++----- etc/openstack_deploy/user_variables.yml | 3 +++ playbooks/vars/configs/keepalived_haproxy.yml | 10 ++++++--- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/doc/source/install-guide/configure-haproxy.rst b/doc/source/install-guide/configure-haproxy.rst index 5c50e35bb1..03d42551d4 100644 --- a/doc/source/install-guide/configure-haproxy.rst +++ b/doc/source/install-guide/configure-haproxy.rst @@ -77,16 +77,26 @@ edit the ``/etc/openstack_deploy/user_variables.yml`` by setting: keepalived_use_latest_stable: True -The HAProxy playbook makes use of the variable file -``vars/configs/keepalived_haproxy.yml``, and feeds its content -to the keepalived role, for keepalived master and backup nodes. +The HAProxy playbook reads the ``vars/configs/keepalived_haproxy.yml`` +variable file and provides its content to the keepalived role for +keepalived master and backup nodes. -You can use your own variable file by setting -the path in your ``/etc/openstack_deploy/user_variables.yml``: +Keepalived pings a public IP address to check its status. The default +address is ``193.0.14.129``. To change this default, for example to +your gateway, set the ``keepalived_ping_address`` variable in the +``user_variables.yml`` file. + +.. note:: The keepalived test works with IPv4 addresses only. + +You can define additional variables to adapt keepalived to the +deployed environment. Refer to the ``user_variables.yml`` file for +more information. Optionally, you can use your own variable file, as +follows: .. code-block:: yaml - haproxy_keepalived_vars_file: + haproxy_keepalived_vars_file: /path/to/myvariablefile.yml + Securing HAProxy communication with SSL certificates #################################################### diff --git a/etc/openstack_deploy/user_variables.yml b/etc/openstack_deploy/user_variables.yml index 96aa5751d7..fe7d3f51b2 100644 --- a/etc/openstack_deploy/user_variables.yml +++ b/etc/openstack_deploy/user_variables.yml @@ -167,6 +167,9 @@ verbose: false # haproxy_keepalived_priority_master: # haproxy_keepalived_priority_backup: +# Keepalived default IP address used to check its alive status (IPv4 only) +# keepalived_ping_address: "193.0.14.129" + # All the previous variables are used in a var file, fed to the keepalived role. # To use another file to feed the role, override the following var: # haproxy_keepalived_vars_file: 'vars/configs/keepalived_haproxy.yml' diff --git a/playbooks/vars/configs/keepalived_haproxy.yml b/playbooks/vars/configs/keepalived_haproxy.yml index 042aa80402..c7a9620d7d 100644 --- a/playbooks/vars/configs/keepalived_haproxy.yml +++ b/playbooks/vars/configs/keepalived_haproxy.yml @@ -13,7 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -keepalived_sync_groups: +keepalived_ping_address: "193.0.14.129" +keepalived_ping_count: 1 +keepalived_ping_interval: 10 + +keepalived_global_sync_groups: haproxy: instances: - external @@ -28,8 +32,8 @@ keepalived_scripts: haproxy_check_script: check_script: "killall -0 haproxy" pingable_check_script: - check_script: "ping -c 1 193.0.14.129 1>&2" - interval: 10 + check_script: "ping -c {{ keepalived_ping_count }} {{ keepalived_ping_address }} 1>&2" + interval: "{{ keepalived_ping_interval }}" fall: 2 rise: 4