roles/haproxy: added

This commit is contained in:
dogeystamp 2023-08-23 18:22:50 -04:00
parent d5f07cb1c3
commit 1ddb72e734
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
4 changed files with 47 additions and 0 deletions

View File

@ -54,6 +54,9 @@ all:
caddy:
hosts:
your_bastion_host:
haproxy:
hosts:
your_bastion_host:
sshd:
hosts:
your_bastion_host:

View File

@ -0,0 +1,17 @@
---
- name: Install haproxy package
community.general.pacman:
name:
- haproxy
- name: Deploy haproxy config
template:
src: haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
- name: Enable haproxy service
systemd:
name: haproxy
enabled: yes
state: started

View File

@ -0,0 +1,22 @@
defaults
log global
mode tcp
timeout connect 10s
timeout client 36h
timeout server 36h
{% if groups["gitea"] | length > 0 %}
listen gitea_ssh
bind *:2499
balance leastconn
mode tcp
option tcp-check
tcp-check expect rstring SSH-2.0-OpenSSH.*
{% for host in groups["gitea"] %}
server {{ host }} {{ host_vars[host]["local_ip"] }}:2499
{% endfor %}
{% endif %}

View File

@ -69,6 +69,11 @@
- caddy
when: "caddy" in group_names
- role: haproxy
tags:
- haproxy
when: "haproxy" in group_names
- role: dotfiles
tags:
- dotfiles