Initial commit
All checks were successful
Ansible Playbook lint / ansible-lint (push) Successful in 35s
All checks were successful
Ansible Playbook lint / ansible-lint (push) Successful in 35s
This commit is contained in:
5
roles/configure_haproxy/handlers/main.yml
Normal file
5
roles/configure_haproxy/handlers/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Reload haproxy
|
||||
ansible.builtin.systemd_service:
|
||||
name: haproxy
|
||||
state: reloaded
|
||||
14
roles/configure_haproxy/tasks/main.yml
Normal file
14
roles/configure_haproxy/tasks/main.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Copy haproxy.cfg
|
||||
ansible.builtin.copy:
|
||||
src: haproxy.cfg.jinja
|
||||
dest: /etc/haproxy/haproxy.cfg
|
||||
mode: '0600'
|
||||
owner: root
|
||||
group: root
|
||||
notify: Reload haproxy
|
||||
- name: Enable and start haproxy
|
||||
ansible.builtin.systemd_service:
|
||||
name: haproxy.service
|
||||
state: started
|
||||
enabled: true
|
||||
69
roles/configure_haproxy/templates/haproxy.cfg.jinja
Normal file
69
roles/configure_haproxy/templates/haproxy.cfg.jinja
Normal file
@@ -0,0 +1,69 @@
|
||||
#---------------------------------------------------------------------
|
||||
# Example configuration. See the full configuration manual online.
|
||||
#
|
||||
# http://www.haproxy.org/download/2.5/doc/configuration.txt
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
global
|
||||
maxconn 20000
|
||||
log 127.0.0.1 local0
|
||||
user haproxy
|
||||
pidfile /run/haproxy.pid
|
||||
daemon
|
||||
|
||||
userlist creds
|
||||
user {{ username }} insecure-password {{ password }}
|
||||
|
||||
frontend secure
|
||||
bind :8080
|
||||
http-request auth unless { http_auth(creds) }
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
option dontlognull
|
||||
option forwardfor except 127.0.0.0/8
|
||||
maxconn 8000
|
||||
timeout client 30s
|
||||
|
||||
use_backend rank if { hdr(host) -i {{ dns_prefix }}-ranking.{{ dns_suffix }} }
|
||||
use_backend admin if { hdr(host) -i {{ dns_prefix }}-admin.{{ dns_suffix }} }
|
||||
default_backend contest
|
||||
|
||||
frontend main
|
||||
bind :80
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
option dontlognull
|
||||
option forwardfor except 127.0.0.0/8
|
||||
maxconn 8000
|
||||
timeout client 30s
|
||||
|
||||
use_backend rank if { hdr(host) -i {{ dns_prefix }}-ranking.{{ dns_suffix }} }
|
||||
use_backend admin if { hdr(host) -i {{ dns_prefix }}-admin.{{ dns_suffix }} }
|
||||
default_backend contest
|
||||
|
||||
backend contest
|
||||
mode http
|
||||
balance roundrobin
|
||||
timeout connect 5s
|
||||
timeout server 30s
|
||||
timeout queue 30s
|
||||
server contest1 127.0.0.1:8888 check
|
||||
|
||||
backend admin
|
||||
mode http
|
||||
balance roundrobin
|
||||
timeout connect 5s
|
||||
timeout server 30s
|
||||
timeout queue 30s
|
||||
server admin1 127.0.0.1:8889 check
|
||||
|
||||
backend rank
|
||||
mode http
|
||||
balance roundrobin
|
||||
timeout connect 5s
|
||||
timeout server 30s
|
||||
timeout queue 30s
|
||||
server rank1 127.0.0.1:8890 check
|
||||
Reference in New Issue
Block a user