aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/loadbalancer/tasks/config_validate.yml
blob: acb6f99128a0d43bf63b8859dc413ba4b9e8e5a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- name: Validating haproxy config files
  vars:
    service: "{{ loadbalancer_services['haproxy'] }}"
  command: >-
    {{ 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