From 46d2abf3f700268aa004d6d6ed94b76f65ca914a Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Wed, 17 Jun 2015 07:06:17 +0000 Subject: [PATCH] Show proxy name on varnish errors --- roles/varnish/tasks/main.yml | 4 ++-- .../proxy.vcl => templates/proxy.vcl.j2} | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) rename roles/varnish/{files/proxy.vcl => templates/proxy.vcl.j2} (93%) diff --git a/roles/varnish/tasks/main.yml b/roles/varnish/tasks/main.yml index a3d46041d4..ff62f01789 100644 --- a/roles/varnish/tasks/main.yml +++ b/roles/varnish/tasks/main.yml @@ -26,8 +26,8 @@ - varnish - name: install /etc/varnish/default.vcl - copy: src={{ item }} dest=/etc/varnish/default.vcl - owner=root group=root + template: src=proxy.vcl dest=/etc/varnish/default.vcl + owner=root group=root with_items: - proxy.vcl notify: diff --git a/roles/varnish/files/proxy.vcl b/roles/varnish/templates/proxy.vcl.j2 similarity index 93% rename from roles/varnish/files/proxy.vcl rename to roles/varnish/templates/proxy.vcl.j2 index 464a754685..d9003fcbbf 100644 --- a/roles/varnish/files/proxy.vcl +++ b/roles/varnish/templates/proxy.vcl.j2 @@ -134,6 +134,27 @@ acl purge { "192.168.1.58"; //lockbox01.vpn } +sub vcl_synth { + set resp.http.Content-Type = "text/html; charset=utf-8"; + set resp.http.Retry-After = "5"; + synthetic( {" + + + "} + resp.status + " " + resp.reason + {" + + +

Error "} + resp.status + " " + resp.reason + {"

+

"} + resp.reason + {"

+

Guru Meditation:

+

XID: "} + req.xid + {"

+
+

Varnish cache server on {{ ansible_fqdn }}

+ + +"} ); + return (deliver); +} + sub vcl_recv { if (req.method == "PURGE") { if (!client.ip ~ purge) {