Browse Source

Update some vars and add other ones

master
Alex 2 years ago
parent
commit
190452473b
Signed by: caskd GPG Key ID: F92BA85F61F4C173
  1. 2
      tasks/main.yml
  2. 8
      templates/haproxy.conf.j2
  3. 7
      vars/main.yml

2
tasks/main.yml

@ -1,6 +1,6 @@
- name: Copy HAProxy files
loop:
- { src: 'haproxy.conf.j2', dest: '/etc/haproxy/haproxy.cfg' }
- { src: 'haproxy.conf.j2', dest: '{{ haproxy.config }}' }
template:
follow: yes
src: "{{ item.src }}"

8
templates/haproxy.conf.j2

@ -1,7 +1,7 @@
global
maxconn 2048
maxconnrate 40
unix-bind prefix /run/haproxy user nobody group nogroup
unix-bind prefix {{ haproxy.socketroot }} user {{ haproxy.user }} group {{ haproxy.group }}
defaults
mode http
@ -29,7 +29,7 @@ resolvers local
hold nx 100ms
hold timeout 3s
hold valid 5s
{% for entry in services.haproxy.ports.tcp %}
{% for entry in haproxy.ports.tcp %}
listen {{ entry.group }}
mode tcp
@ -47,7 +47,7 @@ frontend http
acl root url /
{% for domains in services.haproxy.public %}
{% for domains in haproxy.public %}
use_backend backend-{{ domains.service }} if { hdr_beg(host) -i {{ domains.domain }} }
{% endfor %}
@ -56,7 +56,7 @@ frontend http
http-response set-header X-Content-Type-Options nosniff
http-response set-header Referrer-Policy no-referrer-when-downgrade
http-response set-header Strict-Transport-Security max-age=31536000;\ includeSubDomains;\ preload
{% for domains in services.haproxy.public %}
{% for domains in haproxy.public %}
backend backend-{{ domains.service }}
server-template {{ domains.service }} 1 _{{ domains.service }}._tcp.redxen.localhost

7
vars/main.yml

@ -1,7 +0,0 @@
apt_packages:
- { package: "haproxy", state: present }
systemd:
services:
- { name: "haproxy", enabled: true, action: reloaded, daemon_reload: true}
overrides:
- "haproxy"