blob: a1abf23c4b1fef5c3051e04f101cd66ec43d9630 (
plain) (
tree)
|
|
# relayd ~~ /etc/relayd.conf
# managed by Ansible
# ====== #
# tables
# ====== #
table <local> { 127.0.0.1 }
{% for h in groups["servers"] %}
{% set h = dict(hostvars[h]) %}
{##}
{% if h.ip.in is defined %}
table <{{ h.ansible_host }}> { {{ h.ip.in }} }
{% endif %}
{##}
{% endfor %}
# ================ #
# filter for vhost
# ================ #
http protocol reverse_proxy {
pass request header "Host" value "{{ global.domain_name }}" forward to <local>
{% for h in groups["servers"] %}
{% set h = dict(hostvars[h]) %}
{##}
{% if h.ip.in is defined %}
{% for service in h.services if service.domain is defined %}
pass request header "Host" value "{{ service.domain }}.{{ global.domain_name }}" forward to <{{ h.ansible_host }}>
{% endfor %}
{% endif %}
{##}
{% endfor %}
}
# ======================= #
# relays for all protocol
# ======================= #
relay www {
listen on egress port 80
protocol reverse_proxy
forward to <local> port 80 check icmp
{% for hostname in groups["servers"] %}
{% set h = dict(hostvars[hostname]) %}
{% for service in h.services if service.domain is defined %}
forward to <{{ hostname }}> port {{ service.port }} check icmp
{% endfor %}
{% endfor %}
}
|