aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/loadbalancer/templates/haproxy/haproxy_main.cfg.j2
blob: cc7f9737e4f6547f0361b6431611ac4578c8df72 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#jinja2: lstrip_blocks: True
global
    chroot /var/lib/haproxy
    user haproxy
    group haproxy
    daemon
    log {{ syslog_server }}:{{ syslog_udp_port }} {{ syslog_haproxy_facility }}
    maxconn {{ haproxy_max_connections }}
    nbthread {{ haproxy_threads }}
    {% if (haproxy_threads | int > 1) and (haproxy_thread_cpu_map | bool) %}
    cpu-map auto:1/all 0-63
    {% endif %}
    stats socket /var/lib/kolla/haproxy/haproxy.sock group kolla mode 660{% if haproxy_socket_level_admin | bool %} level admin{% endif %}

    {% if kolla_enable_tls_external | bool or kolla_enable_tls_internal | bool %}
    {%     for line in haproxy_ssl_settings.split('\n') %}
    {{ line }}
    {%     endfor %}
    tune.ssl.default-dh-param 4096
    ca-base {{ haproxy_backend_cacert_dir }}
    {% endif %}

defaults
    log global
    option redispatch
    retries 3
    timeout http-request {{ haproxy_http_request_timeout }}
    timeout http-keep-alive {{ haproxy_http_keep_alive_timeout }}
    timeout queue {{ haproxy_queue_timeout }}
    timeout connect {{ haproxy_connect_timeout }}
    timeout client {{ haproxy_client_timeout }}
    timeout server {{ haproxy_server_timeout }}
    timeout check {{ haproxy_check_timeout }}
    balance {{ haproxy_defaults_balance }}
    maxconn {{ haproxy_defaults_max_connections }}

listen stats
   bind {{ api_interface_address }}:{{ haproxy_stats_port }}
   mode http
   stats enable
   stats uri /
   stats refresh 15s
   stats realm Haproxy\ Stats
   stats auth {{ haproxy_user }}:{{ haproxy_password }}

{% if enable_prometheus_haproxy_exporter | bool %}
listen metrics
   bind {{ api_interface_address }}:{{ prometheus_haproxy_exporter_port }}
   mode http
   http-request use-service prometheus-exporter if { path /metrics }
{% endif %}

frontend status
    bind {{ api_interface_address }}:{{ haproxy_monitor_port }}
    {% if api_interface_address != kolla_internal_vip_address %}
    bind {{ kolla_internal_vip_address }}:{{ haproxy_monitor_port }}
    {% endif %}
    mode http
    monitor-uri /