Template haproxy better

This commit is contained in:
Jake Howard 2020-01-17 22:56:45 +00:00
parent 78fa36f20a
commit f6ffb1ceef
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 31 additions and 28 deletions

View file

@ -1,4 +1,7 @@
haproxy: haproxy:
exposed_ports:
- 8448
- 4242
stats_pass: !vault | stats_pass: !vault |
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
61356632383432353833616431393962613037646634656133316135363465313962663061633830 61356632383432353833616431393962613037646634656133316135363465313962663061633830

View file

@ -40,7 +40,7 @@ defaults
listen https listen https
bind *:443 bind *:443
mode tcp mode tcp
server default {{ wireguard.intersect.ip }}:443 check send-proxy server default {{ wireguard.clients.intersect.ip }}:443 send-proxy
listen http listen http
bind *:80 bind *:80
@ -48,15 +48,13 @@ listen http
stats show-node stats show-node
stats uri /haproxy stats uri /haproxy
stats auth stats:{{ haproxy.stats_pass }} stats auth stats:{{ haproxy.stats_pass }}
server default {{ wireguard.intersect.ip }}:80 check server default {{ wireguard.clients.intersect.ip }}:80 check
{% for port in haproxy.exposed_ports %}
listen matrix listen expose_{{ port }}
bind *:8448 bind *:{{ port }}
mode tcp mode tcp
server default {{ wireguard.clients.intersect.ip }}:8448 check server default {{ wireguard.clients.intersect.ip }}:{{ port }}
listen gitea {% endfor %}
bind *:3022
mode tcp
server default {{ wireguard.clients.intersect.ip }}:3022 check

View file

@ -1,21 +1,23 @@
# - name: Install Haproxy - name: Install Haproxy
# apt: apt:
# name: haproxy name: haproxy
# become: true become: true
# become_user: root become_user: root
# - name: Haproxy config - name: Haproxy config
# template: template:
# src: files/haproxy.cfg src: files/haproxy.cfg
# dest: /etc/haproxy/haproxy.cfg dest: /etc/haproxy/haproxy.cfg
# validate: /usr/sbin/haproxy -c -- %s validate: /usr/sbin/haproxy -c -- %s
# backup: yes backup: yes
# become: true become: true
# become_user: root become_user: root
# register: haproxy_config register: haproxy_config
# - name: Restart Haproxy - name: Restart Haproxy
# service: service:
# name: haproxy name: haproxy
# state: reloaded state: restarted
# when: haproxy_config.changed become: true
become_user: root
when: haproxy_config.changed