diff --git a/states/haproxy/map.jinja b/states/haproxy/map.jinja index 1feb7c7..547fbf9 100644 --- a/states/haproxy/map.jinja +++ b/states/haproxy/map.jinja @@ -8,6 +8,7 @@ {%- set net = salt['pillar.get']('net') -%} {%- set fqdn = salt['grains.get']('fqdn') -%} {%- set country = salt['grains.get']('country') -%} +{%- set location = salt['grains.get']('location') -%} {% set peers_ip = [] %} {%- for k,v in haproxy.peers.items() %} diff --git a/states/haproxy/templates/haproxy.cfg.j2 b/states/haproxy/templates/haproxy.cfg.j2 index 79d85ce..fdb677f 100644 --- a/states/haproxy/templates/haproxy.cfg.j2 +++ b/states/haproxy/templates/haproxy.cfg.j2 @@ -94,6 +94,7 @@ global mworker-max-reloads 2 maxconn 1000 set-var proc.country str('{{ country }}') + set-var proc.location str('{{ location }}') lua-prepend-path {{ haproxy.config.dir }}/mods/?.so cpath lua-prepend-path {{ haproxy.config.dir }}/scripts/?.lua {%- for script,params in haproxy.config.scripts.items() %} @@ -184,7 +185,7 @@ frontend fe_http from {{ haproxy.config.namespace }} ## Returns http-request return status 200 content-type text/plain string "User-agent: *\r\nAllow: /" if robots_txt http-request return status 200 content-type text/plain string "Contact: mailto:{{ haproxy.config.syscontact }}" if security_txt - http-request return status 200 content-type "text/html; charset=utf-8" lf-string "host: %H
country: %[var(proc.country)]
date: %[var(txn.httpdate)]
src: %[var(req.src)]
srchash: %[var(txn.srchash)]" if self_host path_info + http-request return status 200 content-type "text/html; charset=utf-8" lf-string "host: %H
location: %[var(proc.location)], %[var(proc.country)]
date: %[var(txn.httpdate)]
src: %[var(req.src)]
srchash: %[var(txn.srchash)]" if self_host path_info {%- if haproxy.config.http_overrides|default([]) %} {%- for override in haproxy.config.http_overrides %} @@ -262,7 +263,7 @@ frontend fe_https from {{ haproxy.config.namespace }} ## Returns http-request return status 200 content-type text/plain string "User-agent: *\r\nAllow: /" if robots_txt http-request return status 200 content-type text/plain lf-file /etc/haproxy/static/security.txt if security_txt - http-request return status 200 content-type "text/html; charset=utf-8" lf-string "host: %H
country: %[var(proc.country)]
date: %[var(txn.httpdate)]
src: %[var(req.src)]
srchash: %[var(txn.srchash)]" if self_host path_info + http-request return status 200 content-type "text/html; charset=utf-8" lf-string "host: %H
location: %[var(proc.location)], %[var(proc.country)]
date: %[var(txn.httpdate)]
src: %[var(req.src)]
srchash: %[var(txn.srchash)]" if self_host path_info ## Headers http-request set-header X-Proxy-Id "%H"