Files
openstack-ansible/playbooks/vars/configs/keepalived_haproxy.yml
Jean-Philippe Evrard 12a3fbafd0 Fixing keepalived bug when 2+ backup nodes have the same priority
The issue is present if you're running 2 or more nodes with
a keepalived < 1.2.8. This bumps the version of keepalived role
(installing a more recent version of keepalived by default) AND
edits the keepalived configuration file to avoid having nodes
with the same priority.

This will restart your keepalived service.

Please note this commit is not meant for backporting. The deployer
running on mitaka and below should follow the documentation here:
https://review.openstack.org/#/c/279664/

Bug: #1545066

Change-Id: Ie28d2d3fa8670212c64ecbdf5a87314e7ca0a2d9
2016-04-13 12:05:32 +00:00

64 lines
3.0 KiB
YAML

---
# Copyright 2015, Jean-Philippe Evrard <jean-philippe@evrard.me>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
keepalived_sync_groups:
haproxy:
instances:
- external
- internal
notify_script: /etc/keepalived/haproxy_notify.sh
##if a src_*_script is defined, it will be uploaded from src_*_script
##on the deploy host to the *_script location. Make sure *_script is
##a location in that case.
src_notify_script: vars/configs/keepalived_haproxy_notifications.sh
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
fall: 2
rise: 4
# If you have more than 5 keepalived nodes, you should build your own script
# (handling master and backups servers), and replace in keepalived_instances:
# priority: "{{ ((play_hosts|length-play_hosts.index(inventory_hostname))*100)-((play_hosts|length-play_hosts.index(inventory_hostname))*50) }}"
# by
# priority: "{{ (play_hosts.index(inventory_hostname) == 0) | ternary('100','50') }}"
keepalived_instances:
external:
interface: "{{ haproxy_keepalived_external_interface | default(management_bridge) }}"
state: "{{ (play_hosts.index(inventory_hostname) == 0) | ternary('MASTER', 'BACKUP') }}"
virtual_router_id: "{{ haproxy_keepalived_external_virtual_router_id | default ('10') }}"
priority: "{{ ((play_hosts|length-play_hosts.index(inventory_hostname))*100)-((play_hosts|length-play_hosts.index(inventory_hostname))*50) }}"
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
vips:
- "{{ haproxy_keepalived_external_vip_cidr }} dev {{ haproxy_keepalived_external_interface | default(management_bridge) }}"
track_scripts:
- haproxy_check_script
- pingable_check_script
internal:
interface: "{{ haproxy_keepalived_internal_interface | default(management_bridge) }}"
state: "{{ (play_hosts.index(inventory_hostname) == 0) | ternary('MASTER', 'BACKUP') }}"
virtual_router_id: "{{ haproxy_keepalived_internal_virtual_router_id | default ('11') }}"
priority: "{{ ((play_hosts|length-play_hosts.index(inventory_hostname))*100)-((play_hosts|length-play_hosts.index(inventory_hostname))*50) }}"
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
track_scripts:
- haproxy_check_script
- pingable_check_script
vips:
- "{{ haproxy_keepalived_internal_vip_cidr }} dev {{ haproxy_keepalived_internal_interface | default(management_bridge) }}"