Go to file
2023-07-21 17:15:34 +03:00
defaults fix selinux and make default config working with haproxy up to v2.6.10 2023-03-12 20:44:33 +03:00
handlers split variables for RedHat and Debain os family 2023-04-16 03:27:24 +03:00
meta initial commit 2023-02-08 01:36:25 +03:00
tasks fix mistype 2023-07-05 12:37:22 +03:00
templates initial commit 2023-02-08 01:36:25 +03:00
vars add Debian 12 support 2023-07-21 17:15:34 +03:00
.gitignore initial commit 2023-02-08 01:36:25 +03:00
README.md initial commit 2023-02-08 01:36:25 +03:00

Setup HAProxy service

Config example:

haproxy_ssl: yes
haproxy_self_sign_cert: yes
haproxy_config:
  frontend:
    well-known:
      bind: ':80'
      mode: http
      acl:
        - letsencrypt-acl path_beg /.well-known/acme-challenge/
        - has_cors res.hdr(Access-Control-Allow-Origin) -m found
      http-request:
        - redirect scheme https if !{ path_beg /.well-known/acme-challenge/ } !{ ssl_fc }
      use_backend:
        - letsencrypt-backend if letsencrypt-acl
    https:
      bind: ':443 ssl crt {{ haproxy_ssl_path }}'
      mode: http
      acl:
        - letsencrypt-acl path_beg /.well-known/acme-challenge/
      use_backend:
        - letsencrypt-backend if letsencrypt-acl
      default_backend: localhost_5001
  backend:
    letsencrypt-backend:
      mode: http
      server:
        - letsencrypt 127.0.0.1:8080
    localhost_5001:
      mode: http
      server:
        - localhost 127.0.0.1:5001
  listen:
    rabbitmq:
      bind: "10.89.10.112:5672"
      mode: tcp
      option:
        - tcpka
      server:
        - t1-dev-rabbitmq-1 10.89.10.71:5672 check inter 2000 rise 2 fall 5
        - t1-dev-rabbitmq-2 10.89.10.72:5672 check inter 2000 rise 2 fall 5
        - t1-dev-rabbitmq-3 10.89.10.73:5672 check inter 2000 rise 2 fall 5
    rabbitmq_management:
      bind: "10.89.10.112:15672"
      mode: http
      server:
        - t1-dev-rabbitmq-1 10.89.10.71:15672 check inter 2000 rise 2 fall 5
        - t1-dev-rabbitmq-2 10.89.10.72:15672 check inter 2000 rise 2 fall 5
        - t1-dev-rabbitmq-3 10.89.10.73:15672 check inter 2000 rise 2 fall 5
    stats:
      bind: ":9000"
      mode: http
      stats:
        - enable
        - hide-version
        - realm Haproxy\ Statistics
        - uri /haproxy_stats
        - auth {{ haproxy_stats_user }}:{{ haproxy_stats_password }}

Map example:

haproxy_map:
  hosts.map: |
    #domainname           backendname
    example.com backend
    *.example.com backend

Lua example:

haproxy_lua:
  invertPath.lua: |
    local function invertPath(host)
      host = host:gsub('website.*','')
      a, b = host:match"(.*)%.([^.]+)"
      -- print(a)
      -- print(b)
      s = b .. ":" .. a
      return s
    end
    
    core.register_converters("invertPath", invertPath)