updated haproxy state

This commit is contained in:
Paul 2023-08-07 16:03:04 +02:00
parent df43532999
commit 5920871ee9
3 changed files with 9 additions and 7 deletions

View File

@ -56,10 +56,10 @@ haproxy:
lib: true lib: true
- name: scripts/collector.lua - name: scripts/collector.lua
lib: false lib: false
- name: scripts/weight.lua #- name: scripts/weight.lua
lib: false # lib: false
args: # args:
- 5 # - 5
- name: scripts/state.lua - name: scripts/state.lua
lib: false lib: false
args: args:

View File

@ -18,13 +18,13 @@ http-response return status 403 content-type text/html string "<h1>403 forbidden
http-response return status 404 content-type text/html string "<h1>404 not found</h1>" if { status 404 } http-response return status 404 content-type text/html string "<h1>404 not found</h1>" if { status 404 }
{%- endmacro -%} {%- endmacro -%}
{%- macro httpcheckrules(layer="layer7",inter="2s",fall=5,rise=5) -%}check observe {{ layer }} inter {{ inter }} fall {{ fall }} rise {{ rise }}{%- endmacro -%} {%- macro httpcheckrules(layer="layer7",inter="1s",fall=5,rise=5) -%}check observe {{ layer }} inter {{ inter }} fall {{ fall }} rise {{ rise }}{%- endmacro -%}
{%- macro httpsslrules() -%}ssl verify none{%- endmacro -%} {%- macro httpsslrules(h2=False) -%}ssl verify none{{ " alpn h2,http/1.1" if h2 }}{%- endmacro -%}
{%- macro httpendpoints(servers=[], check=True, disabled=False) -%} {%- macro httpendpoints(servers=[], check=True, disabled=False) -%}
{%- for server in servers %} {%- for server in servers %}
server {{ server.name }} {{ server.name }}:{{ server.port }}{{ " " + httpcheckrules(inter=server.inter|default("2s"), fall=server.fall|default(5), rise=server.rise|default(5)) if check }}{{ " " + httpsslrules() if server.ssl|default(False) }}{{ " disabled" if server.disabled|default(False) }}{{ " send-proxy" if server.proxy|default(False) }}{{ " on-marked-down shutdown-sessions on-marked-up shutdown-backup-sessions" if server.killsessions|default(False) }} server {{ server.name }} {{ server.name }}:{{ server.port }}{{ " " + httpcheckrules(inter=server.inter|default("1s"), fall=server.fall|default(5), rise=server.rise|default(5)) if check }}{{ " " + httpsslrules(server.h2|default(False)) if server.ssl|default(False) }}{{ " disabled" if server.disabled|default(False) }}{{ " send-proxy" if server.proxy|default(False) }}{{ " on-marked-down shutdown-sessions on-marked-up shutdown-backup-sessions" if server.killsessions|default(False) }}
{%- endfor %} {%- endfor %}
{%- endmacro -%} {%- endmacro -%}

View File

@ -1,5 +1,7 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }} ## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "haproxy/map.jinja" import net with context %} {%- from "haproxy/map.jinja" import net with context %}
{%- if net.ip_networks -%}
{%- for network in net.ip_networks %} {%- for network in net.ip_networks %}
{{ network }} {{ network }}
{%- endfor %} {%- endfor %}
{%- endif -%}