Sven Kieske 6435dee265
add a config validation precheck for haproxy
Signed-off-by: Sven Kieske <kieske@osism.tech>
Change-Id: Iffcce707e0248f166cd71a0b0c1c4a032c8435c6
2024-06-27 12:52:06 +02:00

28 lines
799 B
YAML

---
- name: Validating haproxy config files
vars:
service: "{{ loadbalancer_services['haproxy'] }}"
shell: >-
{{ kolla_container_engine }} exec -i haproxy haproxy
-c -f /etc/haproxy/haproxy.cfg -f /etc/haproxy/services.d/
register: haproxy_config_validation_result
check_mode: false
become: true
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
- name: Assert haproxy config is valid
vars:
service: "{{ loadbalancer_services['haproxy'] }}"
assert:
that:
- haproxy_config_validation_result.rc == 0
fail_msg: >-
haproxy config is invalid or
validation could not be performed.
success_msg: "haproxy config is valid"
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool