Skip to content
Snippets Groups Projects
Commit 6f87f4f5 authored by jurgenhaas's avatar jurgenhaas
Browse files

Make HaProxy to support all Drupal domains and aliases as well

parent 7964f4ca
No related branches found
No related tags found
No related merge requests found
......@@ -52,18 +52,14 @@ frontend http-in
{% endfor %}
{% endfor %}
{% for host in groups['all'] %}
{% if hostvars[host].proxy_domains is defined %}
acl domain_in_{{host}} hdr_dom(host) -i -f /etc/haproxy/{{host}}.list
use_backend backend_{{host}} if domain_in_{{host}}
{% endif %}
{% if hostvars[host].proxy_crm_domains is defined %}
acl crm_domain_in_{{host}} hdr_dom(host) -i -f /etc/haproxy/{{host}}.crm.list
use_backend backend_{{host}} if crm_domain_in_{{host}}
{% endif %}
{% if hostvars[host].proxy_ssl_domains is defined %}
acl redirect_ssl_{{host}} hdr_dom(host) -i -f /etc/haproxy/{{host}}.ssl.list
use_backend backend_redirect_ssl if redirect_ssl_{{host}}
{% endif %}
{% endfor %}
{% for cert in proxy_certificates %}
......@@ -77,14 +73,10 @@ frontend https-in
{% endfor %}
{% endfor %}
{% for host in groups['all'] %}
{% if hostvars[host].proxy_ssl_domains is defined %}
acl ssl_domain_in_{{host}} hdr_dom(host) -i -f /etc/haproxy/{{host}}.ssl.list
use_backend backend_{{host}} if ssl_domain_in_{{host}}
{% endif %}
{% if hostvars[host].proxy_domains is defined %}
acl redirect_{{host}} hdr_dom(host) -i -f /etc/haproxy/{{host}}.list
use_backend backend_redirect if redirect_{{host}}
{% endif %}
{% if hostvars[host].proxy_crm_domains is defined %}
acl crm_redirect_{{host}} hdr_dom(host) -i -f /etc/haproxy/{{host}}.list
use_backend backend_redirect if crm_redirect_{{host}}
......@@ -93,11 +85,9 @@ frontend https-in
{% endfor %}
{% for host in groups['all'] %}
{% if (hostvars[host].proxy_domains is defined) or (hostvars[host].proxy_ssl_domains is defined) or (hostvars[host].proxy_crm_domains is defined) %}
backend backend_{{host}}
server server_{{host}} {{hostvars[host]['ansible_default_ipv4']['address']|default(hostvars[host]['static_ipv4'])}}:80 maxconn 32
server server_{{host}} {{hostvars[host]['static_ipv4']|default(hostvars[host]['ansible_default_ipv4']['address'])}}:80 maxconn 32
{% endif %}
{% endfor %}
backend backend_redirect_ssl
......
{% for domain in hostvars[item].proxy_domains|default([]) %}
{{domain}}
{% endfor %}
{% for drupal in hostvars[item].drupal_settings|default([]) %}
{% for domain in drupal.domains|default([]) %}
{% if domain.protocol|default('https') == 'http' %}
{{domain.domain}}
{% for alias in domain.aliases|default([]) %}
{{alias}}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
{% for domain in hostvars[item].proxy_ssl_domains|default([]) %}
{{domain}}
{% endfor %}
{% for drupal in hostvars[item].drupal_settings|default([]) %}
{% for domain in drupal.domains|default([]) %}
{% if domain.protocol|default('https') == 'https' %}
{{domain.domain}}
{% for alias in domain.aliases|default([]) %}
{{alias}}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment