85501cbf26
Instead of defining almost all vars scoped to the 'all'group, we will limit our vars scoping to the group namespace they are consumed in. Vars that are used in 1 group are defined in the group they are used in. This covers most service role vars. Vars that are used in 2 groups (usually linking 2 roles communicating with each other) are now using localhost's host_vars as a proxy. The 2 service groups will then reference hostvars['localhost']['var']. Vars that are used in 3+ groups are left in the 'all' scoping. Change-Id: I09cb22d51985d5f50e98030a455251cc2ea1a205
70 lines
3.5 KiB
YAML
70 lines
3.5 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_ping_address: "193.0.14.129"
|
|
keepalived_ping_count: 1
|
|
keepalived_ping_interval: 10
|
|
keepalived_ubuntu_src: "uca"
|
|
keepalived_uca_apt_repo_url: "{{ uca_apt_repo_url | default('http://ubuntu-cloud.archive.canonical.com/ubuntu') }}"
|
|
|
|
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: "{{ playbook_dir }}/../scripts/keepalived_haproxy_notifications.sh"
|
|
|
|
keepalived_scripts:
|
|
haproxy_check_script:
|
|
check_script: "kill -0 `cat /var/run/haproxy.pid`"
|
|
pingable_check_script:
|
|
check_script: "ping -c {{ keepalived_ping_count }} {{ keepalived_ping_address }} 1>&2"
|
|
interval: "{{ keepalived_ping_interval }}"
|
|
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: "{{ ((ansible_play_hosts|length-ansible_play_hosts.index(inventory_hostname))*100)-((ansible_play_hosts|length-ansible_play_hosts.index(inventory_hostname))*50) }}"
|
|
# by
|
|
# priority: "{{ (ansible_play_hosts.index(inventory_hostname) == 0) | ternary('100','50') }}"
|
|
keepalived_instances:
|
|
external:
|
|
interface: "{{ haproxy_keepalived_external_interface | default(management_bridge) }}"
|
|
state: "{{ (ansible_play_hosts.index(inventory_hostname) == 0) | ternary('MASTER', 'BACKUP') }}"
|
|
virtual_router_id: "{{ haproxy_keepalived_external_virtual_router_id | default ('10') }}"
|
|
priority: "{{ ((ansible_play_hosts|length-ansible_play_hosts.index(inventory_hostname))*100)-((ansible_play_hosts|length-ansible_play_hosts.index(inventory_hostname))*50) }}"
|
|
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
|
|
vips:
|
|
- "{{ haproxy_keepalived_external_vip_cidr | default('169.254.1.1/24') }} 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: "{{ (ansible_play_hosts.index(inventory_hostname) == 0) | ternary('MASTER', 'BACKUP') }}"
|
|
virtual_router_id: "{{ haproxy_keepalived_internal_virtual_router_id | default ('11') }}"
|
|
priority: "{{ ((ansible_play_hosts|length-ansible_play_hosts.index(inventory_hostname))*100)-((ansible_play_hosts|length-ansible_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 | default('169.254.2.1/24') }} dev {{ haproxy_keepalived_internal_interface | default(management_bridge) }}"
|