Split haproxy and keepalived restarts

We need this to be stop-start as haproxy and proxysql need to be
reconfigured simultaneously when switching between them.

This change also introduces checks for service enablement.

Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Change-Id: I2e10f490305f3d8b1b7abbc66ddb40df65c37fe7
This commit is contained in:
Michal Arbet 2022-04-21 18:54:10 +02:00
parent 28b4c5d35c
commit 959b7f7921

View File

@ -46,7 +46,26 @@
listen:
- Restart keepalived container
- name: Restart backup haproxy container
# NOTE(yoctozepto): We need the following to be stop-start as haproxy and
# proxysql need to be reconfigured simultaneously when switching between them.
- name: Stop backup haproxy container
become: true
kolla_docker:
action: "stop_container"
# NOTE(kevko): backup node might not have haproxy yet - ignore
ignore_missing: true
common_options: "{{ docker_common_options }}"
name: "haproxy"
when:
- kolla_action != "config"
- groups.kolla_ha_is_master_False is defined
- inventory_hostname in groups.kolla_ha_is_master_False
listen:
- Restart haproxy container
- Restart keepalived container
- name: Start backup haproxy container
vars:
service_name: "haproxy"
service: "{{ loadbalancer_services[service_name] }}"
@ -64,6 +83,7 @@
- kolla_action != "config"
- groups.kolla_ha_is_master_False is defined
- inventory_hostname in groups.kolla_ha_is_master_False
- service.enabled | bool
listen:
- Restart haproxy container
- Restart keepalived container
@ -92,6 +112,7 @@
- kolla_action != "config"
- groups.kolla_ha_is_master_False is defined
- inventory_hostname in groups.kolla_ha_is_master_False
- service.enabled | bool
listen:
- Restart keepalived container
notify:
@ -103,6 +124,8 @@
become: true
kolla_docker:
action: "stop_container"
# NOTE(yoctozepto): master node might not have haproxy yet - ignore
ignore_missing: true
common_options: "{{ docker_common_options }}"
name: "haproxy"
when:
@ -143,6 +166,7 @@
- kolla_action != "config"
- groups.kolla_ha_is_master_True is defined
- inventory_hostname in groups.kolla_ha_is_master_True
- service.enabled | bool
listen:
- Restart haproxy container
- Restart keepalived container
@ -171,12 +195,20 @@
- kolla_action != "config"
- groups.kolla_ha_is_master_True is defined
- inventory_hostname in groups.kolla_ha_is_master_True
- service.enabled | bool
listen:
- Restart keepalived container
notify:
- Wait for virtual IP to appear
- name: Wait for virtual IP to appear
- name: Wait for haproxy to listen on VIP
vars:
service_name: "haproxy"
service: "{{ loadbalancer_services[service_name] }}"
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ haproxy_monitor_port }}"
when:
- service.enabled | bool
listen:
- Wait for virtual IP to appear