From e0b7c5a15e4f90a1110aed6224930778cc9f0fdc Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sun, 3 Sep 2023 20:09:56 -0400 Subject: [PATCH] roles/haproxy: fix issues --- .../containers/templates/docker-compose.yml.j2 | 2 +- roles/haproxy/tasks/main.yml | 1 + .../templates/{haproxy.j2 => haproxy.cfg.j2} | 18 +++++++++++------- 3 files changed, 13 insertions(+), 8 deletions(-) rename roles/haproxy/templates/{haproxy.j2 => haproxy.cfg.j2} (55%) diff --git a/roles/containers/templates/docker-compose.yml.j2 b/roles/containers/templates/docker-compose.yml.j2 index a9e699d..bfa676f 100644 --- a/roles/containers/templates/docker-compose.yml.j2 +++ b/roles/containers/templates/docker-compose.yml.j2 @@ -16,7 +16,7 @@ services: - GITEA__server__SSH_DOMAIN={{ gitea_domain }} ports: - "3000:3000" - - "2499:22" + - "2498:22" restart: unless-stopped volumes: - {{ dataroot }}/gitea:/data diff --git a/roles/haproxy/tasks/main.yml b/roles/haproxy/tasks/main.yml index 3ba2c2d..b77f425 100644 --- a/roles/haproxy/tasks/main.yml +++ b/roles/haproxy/tasks/main.yml @@ -9,6 +9,7 @@ template: src: haproxy.cfg.j2 dest: /etc/haproxy/haproxy.cfg + lstrip_blocks: true - name: Enable haproxy service systemd: diff --git a/roles/haproxy/templates/haproxy.j2 b/roles/haproxy/templates/haproxy.cfg.j2 similarity index 55% rename from roles/haproxy/templates/haproxy.j2 rename to roles/haproxy/templates/haproxy.cfg.j2 index eb77d7c..c5e032d 100644 --- a/roles/haproxy/templates/haproxy.j2 +++ b/roles/haproxy/templates/haproxy.cfg.j2 @@ -4,19 +4,23 @@ defaults timeout connect 10s timeout client 36h timeout server 36h + balance leastconn {% 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 }} {{ hostvars[host]["local_ip"] }}:2499 + server {{ host }} {{ host }}:2498 +{% endfor %} +{% endif %} + + +{% if groups["syncthing"] | length > 0 and "syncthing" not in group_names %} +listen syncthing + bind *:22000 +{% for host in groups["syncthing"] %} + server {{ host }} {{ host }}:22000 {% endfor %} - {% endif %}