haproxy.cfg.j2 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. global
  2. log 127.0.0.1 local0
  3. log 127.0.0.1 local1 notice
  4. chroot /var/lib/haproxy
  5. stats socket /run/haproxy/admin.sock mode 660 level admin
  6. stats timeout 30s
  7. user haproxy
  8. group haproxy
  9. daemon
  10. # Default SSL material locations
  11. ca-base /etc/ssl/certs
  12. crt-base /etc/ssl/private
  13. # Default ciphers to use on SSL-enabled listening sockets.
  14. # For more information, see ciphers(1SSL).
  15. ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL
  16. defaults
  17. log global
  18. mode http
  19. option httplog
  20. option dontlognull
  21. timeout connect 5000
  22. timeout client 50000
  23. timeout server 50000
  24. errorfile 400 /etc/haproxy/errors/400.http
  25. errorfile 403 /etc/haproxy/errors/403.http
  26. errorfile 408 /etc/haproxy/errors/408.http
  27. errorfile 500 /etc/haproxy/errors/500.http
  28. errorfile 502 /etc/haproxy/errors/502.http
  29. errorfile 503 /etc/haproxy/errors/503.http
  30. errorfile 504 /etc/haproxy/errors/504.http
  31. frontend localnodes
  32. bind *:80
  33. mode http
  34. default_backend nodes
  35. backend nodes
  36. mode http
  37. balance roundrobin
  38. option forwardfor
  39. http-request set-header X-Forwarded-Port %[dst_port]
  40. http-request add-header X-Forwarded-Proto https if { ssl_fc }
  41. option httpchk HEAD / HTTP/1.1\r\nHost:localhost
  42. #server worker_01 172.22.244.81:80 check
  43. {% for host in groups['worker'] %}
  44. server {{ hostvars[host]['inventory_hostname'] }} {{ hostvars[host]['ansible_default_ipv4'].address }}:80 check
  45. {% endfor %}
  46. listen stats
  47. bind *:1936
  48. stats enable
  49. stats uri /
  50. stats hide-version
  51. stats auth admin:admin