--- - name: test if haproxy_stats is set correctly ansible.builtin.assert: that: - haproxy_stats is defined - haproxy_stats is boolean quiet: yes - name: test if haproxy_stats_port is set correctly ansible.builtin.assert: that: - haproxy_stats_port is defined - haproxy_stats_port is number - haproxy_stats_port > 0 - haproxy_stats_port < 65536 quiet: yes - name: test if haproxy_retries is set correctly ansible.builtin.assert: that: - haproxy_retries is defined - haproxy_retries is number - haproxy_retries >= 0 quiet: yes - name: test if timeouts are set correctly ansible.builtin.assert: that: - item is defined - item is string quiet: yes loop: - "{{ haproxy_timeout_http_request }}" - "{{ haproxy_timeout_connect }}" - "{{ haproxy_timeout_client }}" - "{{ haproxy_timeout_server }}" - "{{ haproxy_timeout_http_keep_alive }}" - "{{ haproxy_timeout_check }}" - name: test if haproxy_maxconn is set correctly ansible.builtin.assert: that: - haproxy_maxconn is defined - haproxy_maxconn is number - haproxy_maxconn > 0 quiet: yes - name: test if haproxy_frontends is set correctly ansible.builtin.assert: that: - haproxy_frontends is defined - haproxy_frontends is iterable quiet: yes - name: test if item in haproxy_frontends is set correctly ansible.builtin.assert: that: - item.name is defined - item.name is string - item.address is defined - item.address is string - item.port is defined - item.port is number - item.port > 0 - item.port < 65536 - item.default_backend is defined - item.default_backend is string quiet: yes loop: "{{ haproxy_frontends }}" loop_control: label: "{{ item.name }}" - name: test if item in haproxy_frontends with ssl is set correctly ansible.builtin.assert: that: - item.ssl is boolean - item.crts is defined - item.crts is iterable quiet: yes loop: "{{ haproxy_frontends }}" loop_control: label: "{{ item.name }}" when: - item.ssl is defined - name: test if haproxy_backends is set correctly ansible.builtin.assert: that: - haproxy_backends is defined - haproxy_backends is iterable quiet: yes - name: test if haproxy_backend_default_balance is set correctly ansible.builtin.assert: that: - haproxy_backend_default_balance is defined - haproxy_backend_default_balance is string - haproxy_backend_default_balance in [ "roundrobin", "static-rr", "leastconn", "first", "source", "uri", "url_param", "hdr", "rdp-cookie" ] quiet: yes - name: test if item in haproxy_backends is set correctly ansible.builtin.assert: that: - item.name is defined - item.name is string - (item.balance is defined and item.balance is string and item.balance in [ "roundrobin", "static-rr", "leastconn", "first", "source", "uri", "url_param", "hdr", "rdp-cookie" ]) or item.balance is undefined - item.servers is defined - item.servers is iterable - item.port is defined - item.port is number - item.port > 0 - item.port < 65536 - (item.options is defined and item.options is iterable) or item.options is undefined quiet: yes loop: "{{ haproxy_backends }}" loop_control: label: "{{ item.name }}" - name: test if httpcheck item in haproxy_backends is set correctly ansible.builtin.assert: that: - item.httpcheck is boolean quiet: yes loop: "{{ haproxy_backends }}" loop_control: label: "{{ item.name }}" when: - item.httpcheck is defined - name: test if httpcheck_method item in haproxy_backends is set correctly ansible.builtin.assert: that: - item.httpcheck_method is string - item.httpcheck is defined quiet: yes loop: "{{ haproxy_backends }}" loop_control: label: "{{ item.name }}" when: - item.httpcheck_method is defined