diff --git a/templates/haproxy_cfg b/templates/haproxy_cfg index 7a6f7f4a0e0ad51601bcf32cb2c9d07371302240..8a8e1ab8931a09d7a75d55e108f9501f0c25d5cb 100644 --- a/templates/haproxy_cfg +++ b/templates/haproxy_cfg @@ -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 diff --git a/templates/host_list b/templates/host_list index 56d67eb203e0077ca438b161e44b59f6f12d0252..2ebc16e8804edb19a830a81509dfc51ba1383cf6 100644 --- a/templates/host_list +++ b/templates/host_list @@ -1,3 +1,13 @@ {% 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 %} diff --git a/templates/host_ssl_list b/templates/host_ssl_list index ee5bc3fd89377fc129653553a16f5c56f40db919..f51782b2cb32748174a7588680368e05605160f3 100644 --- a/templates/host_ssl_list +++ b/templates/host_ssl_list @@ -1,3 +1,13 @@ {% 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 %}