aboutsummaryrefslogtreecommitdiffstats
path: root/roles/relayd/templates/relayd.conf.j2
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2022-12-17 21:59:58 +0100
committerRomain Gonçalves <me@rgoncalves.se>2022-12-21 17:19:46 +0100
commit8ce56f15e0751870b56805010241dcfe8389b10f (patch)
tree5cb2c136ea8d829c93810d908e63501ff79afd6e /roles/relayd/templates/relayd.conf.j2
parent783cfa8469c7922f787305e15e95c0619479744b (diff)
downloadrules-8ce56f15e0751870b56805010241dcfe8389b10f.tar.gz
refactor: remove global __services from roles
Diffstat (limited to 'roles/relayd/templates/relayd.conf.j2')
-rw-r--r--roles/relayd/templates/relayd.conf.j220
1 files changed, 10 insertions, 10 deletions
diff --git a/roles/relayd/templates/relayd.conf.j2 b/roles/relayd/templates/relayd.conf.j2
index c97e9da..b66ffa7 100644
--- a/roles/relayd/templates/relayd.conf.j2
+++ b/roles/relayd/templates/relayd.conf.j2
@@ -8,8 +8,8 @@ log connection errors
table <local> { 127.0.0.1 }
{% call(h) macros.loop_valid_hosts("servers") -%}
table <{{ h.inventory_hostname }}> { {{ h.__ip.internal }} }
-{% for service in h.__services if service.domain is defined %}
-table <{{ h.inventory_hostname }}_{{ service.domain }}> { {{ h.__ip.internal }} }
+{% for name, rules in h.relayd_rules.items() if rules.domain is defined %}
+table <{{ h.inventory_hostname }}_{{ rules.domain }}> { {{ h.__ip.internal }} }
{% endfor %}
{%- endcall %}
@@ -34,10 +34,10 @@ http protocol "https" {
tls keypair "{{ relayd_domain_name }}"
pass request quick header "Host" value "{{ relayd_domain_name }}" forward to <local>
{% call(h) macros.loop_valid_hosts("servers") -%}
-{% for service in h.__services if service.domain is defined %}
- {% set domain_name = service.domain ~ "." ~ relayd_domain_name -%}
+{% for name, rules in h.relayd_rules.items() if rules.domain is defined %}
+ {% set domain_name = rules.domain ~ "." ~ relayd_domain_name -%}
tls keypair "{{ domain_name }}"
- pass request quick header "Host" value "{{ domain_name }}" forward to <{{ h.inventory_hostname }}_{{ service.domain }}>
+ pass request quick header "Host" value "{{ domain_name }}" forward to <{{ h.inventory_hostname }}_{{ rules.domain }}>
{% endfor %}
{%- endcall %}
@@ -52,9 +52,9 @@ http protocol "http" {
pass request quick header "Host" value "{{ relayd_domain_name }}" forward to <local>
{% call(h) macros.loop_valid_hosts("servers") -%}
-{% for service in h.__services if service.domain is defined %}
- {% set domain_name = service.domain ~ "." ~ relayd_domain_name -%}
- pass request quick header "Host" value "{{ domain_name }}" forward to <{{ h.inventory_hostname }}_{{ service.domain }}>
+{% for name, rules in h.relayd_rules.items() if rules.domain is defined %}
+ {% set domain_name = rules.domain ~ "." ~ relayd_domain_name -%}
+ pass request quick header "Host" value "{{ domain_name }}" forward to <{{ h.inventory_hostname }}_{{ rules.domain }}>
{% endfor %}
{%- endcall %}
@@ -75,8 +75,8 @@ relay "wwwtls" {
protocol "https"
forward to <local> port 80 check http "/" code 200
{% call(h) macros.loop_valid_hosts("servers") -%}
-{% for service in h.__services if service.domain is defined %}
- forward to <{{ h.inventory_hostname }}_{{ service.domain }}> port {{ service.port }} check tcp
+{% for name, rules in h.relayd_rules.items() if rules.domain is defined %}
+ forward to <{{ h.inventory_hostname }}_{{ rules.domain }}> port {{ rules.port }} check tcp
{% endfor %}
{%- endcall %}
}
remember that computers suck.