diff --git a/README.md b/README.md index 6265a640b860dd8a2dd4dc4199dfdd936a76a4a5..8929e257a7e23e10cc27c04906b7c6df9ade16e6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -#HaProxy# - -##Instruction to prepare a certificate file## +# Instruction to prepare a certificate file For HaProxy to terminate SSL requests we require a single PEM file with all certificate components chained together. diff --git a/tasks/configure.yml b/tasks/configure.yml index 4f5c7fea25b0c50260688edd07c0e517fb14efce..e04621ead58f17068ad52ba8227e68be55fd01b7 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -33,7 +33,7 @@ mode=644 state=touch with_items: '{{ groups.all }}' - notify: 'Proxy | Restart HAProxy' + changed_when: false - name: "Proxy | Create config file" template: src=haproxy_cfg diff --git a/templates/haproxy_cfg b/templates/haproxy_cfg index 0077d4287fe57e8a8934d1544a4133ced6249600..2f81a7a6449767bdf4c5dafe0343ae0a6e3cbdd4 100644 --- a/templates/haproxy_cfg +++ b/templates/haproxy_cfg @@ -110,6 +110,10 @@ frontend https_in_{{ cert.ip }} acl kibana_present hdr(host) -i -n '{{ kibana_domain|default(inventory_hostname) }}' use_backend backend_kibana if kibana_present {% endif %} +{% for external in cert.external|default([]) %} + acl is_{{ external.key }} {{ external.acl }} + use_backend backend_{{ external.key }} if is_{{ external.key }} +{% endfor %} {% if varnish_host|default(false) %} acl static_content path_end .jpg .jpeg .gif .png .ico .swf .css .js .htm .html use_backend backend_varnish if static_content @@ -124,6 +128,11 @@ frontend https_in_{{ cert.ip }} use_backend backend_redirect if crm_redirect_{{host}} {% endif %} {% endfor %} +{% for external in cert.external|default([]) %} + +backend backend_{{ external.key }} + server server_{{ external.key }} {{ external.server }} maxconn 100 +{% endfor %} {% endfor %} {% for host in groups['all'] %}