Template haproxy better
This commit is contained in:
parent
78fa36f20a
commit
f6ffb1ceef
3 changed files with 31 additions and 28 deletions
|
@ -1,4 +1,7 @@
|
|||
haproxy:
|
||||
exposed_ports:
|
||||
- 8448
|
||||
- 4242
|
||||
stats_pass: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
61356632383432353833616431393962613037646634656133316135363465313962663061633830
|
||||
|
|
|
@ -40,7 +40,7 @@ defaults
|
|||
listen https
|
||||
bind *:443
|
||||
mode tcp
|
||||
server default {{ wireguard.intersect.ip }}:443 check send-proxy
|
||||
server default {{ wireguard.clients.intersect.ip }}:443 send-proxy
|
||||
|
||||
listen http
|
||||
bind *:80
|
||||
|
@ -48,15 +48,13 @@ listen http
|
|||
stats show-node
|
||||
stats uri /haproxy
|
||||
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
|
||||
bind *:8448
|
||||
listen expose_{{ port }}
|
||||
bind *:{{ port }}
|
||||
mode tcp
|
||||
server default {{ wireguard.clients.intersect.ip }}:8448 check
|
||||
server default {{ wireguard.clients.intersect.ip }}:{{ port }}
|
||||
|
||||
listen gitea
|
||||
bind *:3022
|
||||
mode tcp
|
||||
server default {{ wireguard.clients.intersect.ip }}:3022 check
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
# - name: Install Haproxy
|
||||
# apt:
|
||||
# name: haproxy
|
||||
# become: true
|
||||
# become_user: root
|
||||
- name: Install Haproxy
|
||||
apt:
|
||||
name: haproxy
|
||||
become: true
|
||||
become_user: root
|
||||
|
||||
# - name: Haproxy config
|
||||
# template:
|
||||
# src: files/haproxy.cfg
|
||||
# dest: /etc/haproxy/haproxy.cfg
|
||||
# validate: /usr/sbin/haproxy -c -- %s
|
||||
# backup: yes
|
||||
# become: true
|
||||
# become_user: root
|
||||
# register: haproxy_config
|
||||
- name: Haproxy config
|
||||
template:
|
||||
src: files/haproxy.cfg
|
||||
dest: /etc/haproxy/haproxy.cfg
|
||||
validate: /usr/sbin/haproxy -c -- %s
|
||||
backup: yes
|
||||
become: true
|
||||
become_user: root
|
||||
register: haproxy_config
|
||||
|
||||
# - name: Restart Haproxy
|
||||
# service:
|
||||
# name: haproxy
|
||||
# state: reloaded
|
||||
# when: haproxy_config.changed
|
||||
- name: Restart Haproxy
|
||||
service:
|
||||
name: haproxy
|
||||
state: restarted
|
||||
become: true
|
||||
become_user: root
|
||||
when: haproxy_config.changed
|
||||
|
|
Loading…
Reference in a new issue