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
This commit is contained in:
Jean-Philippe Evrard 2016-04-14 17:14:19 +01:00 committed by Robb Romans
parent 22bb167bbd
commit ae99efd64c
3 changed files with 26 additions and 9 deletions

View File

@ -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
####################################################

View File

@ -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'

View File

@ -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