Merge "Split keepalived liveness checks for internal/external networks"
This commit is contained in:
commit
9a5bef9a8c
@ -826,6 +826,7 @@
|
|||||||
# deployment. Refer to the ``user_variables.yml`` file for
|
# deployment. Refer to the ``user_variables.yml`` file for
|
||||||
# more information.
|
# more information.
|
||||||
#
|
#
|
||||||
# Keepalived cam ping a public IP address to check its status. To enable this
|
# Keepalived can ping a public and private IP address to check its status. To
|
||||||
# feature, set the ``keepalived_ping_address`` variable in the
|
# enable this feature, set the ``keepalived_external_ping_address`` and
|
||||||
# ``user_variables.yml`` file.
|
# ``keepalived_internal_ping_address`` variables in the ``user_variables.yml``
|
||||||
|
# file.
|
||||||
|
@ -190,4 +190,5 @@ install_method: source
|
|||||||
# haproxy_keepalived_priority_backup:
|
# haproxy_keepalived_priority_backup:
|
||||||
|
|
||||||
# Keepalived default IP address used to check its alive status (IPv4 only)
|
# Keepalived default IP address used to check its alive status (IPv4 only)
|
||||||
# keepalived_ping_address: "193.0.14.129"
|
# keepalived_external_ping_address: "193.0.14.129"
|
||||||
|
# keepalived_internal_ping_address: "193.0.14.129"
|
||||||
|
@ -17,6 +17,8 @@ keepalived_ping_count: 1
|
|||||||
keepalived_ping_interval: 10
|
keepalived_ping_interval: 10
|
||||||
keepalived_ubuntu_src: "native"
|
keepalived_ubuntu_src: "native"
|
||||||
keepalived_ping_address: "{{ ansible_facts['default_ipv4']['gateway'] | default('127.0.0.1') }}"
|
keepalived_ping_address: "{{ ansible_facts['default_ipv4']['gateway'] | default('127.0.0.1') }}"
|
||||||
|
keepalived_external_ping_address: "{{ keepalived_ping_address }}"
|
||||||
|
keepalived_internal_ping_address: "{{ keepalived_ping_address }}"
|
||||||
|
|
||||||
keepalived_global_defs:
|
keepalived_global_defs:
|
||||||
- "enable_script_security"
|
- "enable_script_security"
|
||||||
@ -29,11 +31,20 @@ keepalived_scripts:
|
|||||||
##on the deploy host to the check_script location. If the check_script needs
|
##on the deploy host to the check_script location. If the check_script needs
|
||||||
##parameters, you can define the location under dest_check_script.
|
##parameters, you can define the location under dest_check_script.
|
||||||
src_check_script: "{{ playbook_dir }}/../scripts/keepalived_haproxy_check.sh"
|
src_check_script: "{{ playbook_dir }}/../scripts/keepalived_haproxy_check.sh"
|
||||||
pingable_check_script:
|
pingable_check_script_external:
|
||||||
check_script: "/etc/keepalived/pingable_check.sh {{ keepalived_ping_count }} {{ keepalived_ping_address }}"
|
check_script: "/etc/keepalived/pingable_check.sh {{ keepalived_ping_count }} {{ keepalived_external_ping_address }}"
|
||||||
dest_check_script: "/etc/keepalived/pingable_check.sh"
|
dest_check_script: "/etc/keepalived/pingable_check.sh"
|
||||||
src_check_script: "{{ playbook_dir }}/../scripts/keepalived_pingable_check.sh"
|
src_check_script: "{{ playbook_dir }}/../scripts/keepalived_pingable_check.sh"
|
||||||
interval: "{{ keepalived_ping_interval }}"
|
interval: "{{ keepalived_ping_interval }}"
|
||||||
|
instance: external
|
||||||
|
fall: 2
|
||||||
|
rise: 4
|
||||||
|
pingable_check_script_internal:
|
||||||
|
check_script: "/etc/keepalived/pingable_check.sh {{ keepalived_ping_count }} {{ keepalived_internal_ping_address }}"
|
||||||
|
dest_check_script: "/etc/keepalived/pingable_check.sh"
|
||||||
|
src_check_script: "{{ playbook_dir }}/../scripts/keepalived_pingable_check.sh"
|
||||||
|
interval: "{{ keepalived_ping_interval }}"
|
||||||
|
instance: internal
|
||||||
fall: 2
|
fall: 2
|
||||||
rise: 4
|
rise: 4
|
||||||
|
|
||||||
@ -51,13 +62,13 @@ keepalived_instances:
|
|||||||
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
|
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
|
||||||
vips:
|
vips:
|
||||||
- "{{ haproxy_keepalived_external_vip_cidr | default('169.254.1.1/24') }} dev {{ haproxy_keepalived_external_interface | default(management_bridge) }}"
|
- "{{ haproxy_keepalived_external_vip_cidr | default('169.254.1.1/24') }} dev {{ haproxy_keepalived_external_interface | default(management_bridge) }}"
|
||||||
track_scripts: "{{ keepalived_scripts.keys() | list }}"
|
track_scripts: "{{ keepalived_scripts | dict2items | json_query('[*].{name: key, instance: value.instance}') | rejectattr('instance', 'equalto', 'internal') | map(attribute='name') | list }}"
|
||||||
internal:
|
internal:
|
||||||
interface: "{{ haproxy_keepalived_internal_interface | default(management_bridge) }}"
|
interface: "{{ haproxy_keepalived_internal_interface | default(management_bridge) }}"
|
||||||
state: "{{ (groups['haproxy'].index(inventory_hostname) == 0) | ternary('MASTER', 'BACKUP') }}"
|
state: "{{ (groups['haproxy'].index(inventory_hostname) == 0) | ternary('MASTER', 'BACKUP') }}"
|
||||||
virtual_router_id: "{{ haproxy_keepalived_internal_virtual_router_id | default ('11') }}"
|
virtual_router_id: "{{ haproxy_keepalived_internal_virtual_router_id | default ('11') }}"
|
||||||
priority: "{{ (groups['haproxy']|length-groups['haproxy'].index(inventory_hostname))*50 }}"
|
priority: "{{ (groups['haproxy']|length-groups['haproxy'].index(inventory_hostname))*50 }}"
|
||||||
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
|
authentication_password: "{{ haproxy_keepalived_authentication_password }}"
|
||||||
track_scripts: "{{ keepalived_scripts.keys() | list }}"
|
|
||||||
vips:
|
vips:
|
||||||
- "{{ haproxy_keepalived_internal_vip_cidr | default('169.254.2.1/24') }} dev {{ haproxy_keepalived_internal_interface | default(management_bridge) }}"
|
- "{{ haproxy_keepalived_internal_vip_cidr | default('169.254.2.1/24') }} dev {{ haproxy_keepalived_internal_interface | default(management_bridge) }}"
|
||||||
|
track_scripts: "{{ keepalived_scripts | dict2items | json_query('[*].{name: key, instance: value.instance}') | rejectattr('instance', 'equalto', 'external') | map(attribute='name') | list }}"
|
||||||
|
@ -40,8 +40,12 @@
|
|||||||
hosts: haproxy
|
hosts: haproxy
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
tasks:
|
tasks:
|
||||||
- name: Check if host can connect to keepalived ping IP
|
- name: Check if host can connect to external keepalived ping IP
|
||||||
command: "ping -c 2 {{ keepalived_ping_address }}"
|
command: "ping -c 2 {{ keepalived_external_ping_address }}"
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Check if host can connect to internal keepalived ping IP
|
||||||
|
command: "ping -c 2 {{ keepalived_internal_ping_address }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Checking if keepalived is running
|
- name: Checking if keepalived is running
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
New variables 'keepalived_internal_ping_address' and
|
||||||
|
'keepalived_external_ping_address' allow deployments to decouple liveness
|
||||||
|
checks for HAProxy accessibility via internal and external networks. The
|
||||||
|
previous 'keepalived_ping_address' variable is maintained for backwards
|
||||||
|
compatibility.
|
Loading…
x
Reference in New Issue
Block a user