From e427bbbdaad0f2b83dc69d6d9ac6e70a93389036 Mon Sep 17 00:00:00 2001 From: LinuxSquare Date: Thu, 22 Feb 2024 22:07:19 +0100 Subject: [PATCH] try dynamic ips --- haproxy/files/{haproxy_config => haproxy_config.jinja} | 4 ++-- haproxy/pkg.sls | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) rename haproxy/files/{haproxy_config => haproxy_config.jinja} (92%) diff --git a/haproxy/files/haproxy_config b/haproxy/files/haproxy_config.jinja similarity index 92% rename from haproxy/files/haproxy_config rename to haproxy/files/haproxy_config.jinja index d275ead..8011263 100644 --- a/haproxy/files/haproxy_config +++ b/haproxy/files/haproxy_config.jinja @@ -19,13 +19,13 @@ defaults frontend ssh mode tcp - bind 192.168.122.62:22 + bind {{ ipv4 }}:22 default_backend ssh frontend http mode tcp - bind 192.168.122.62:80 + bind {{ ipv4 }}:80 default_backend http diff --git a/haproxy/pkg.sls b/haproxy/pkg.sls index 828dd93..6846e1b 100644 --- a/haproxy/pkg.sls +++ b/haproxy/pkg.sls @@ -1,4 +1,5 @@ {% from tpldir+"/map.jinja" import haproxy with context %} +{% set ipv4 = grains['ip4_interfaces']['eth0'][0] %} haproxy_pkg_pkgs: pkg.installed: @@ -18,7 +19,7 @@ haproxy_pkg_conf_dir: haproxy_pkg_config: file.managed: - name: /etc/haproxy/haproxy.cfg - - source: salt://{{ tpldir }}/files/haproxy_config + - source: salt://{{ tpldir }}/files/haproxy_config.jinja - user: root - group: root - mode: '0644'