summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Uiterwijk <puiterwijk@redhat.com>2015-06-17 07:06:17 +0000
committerPatrick Uiterwijk <puiterwijk@redhat.com>2015-06-17 07:07:24 +0000
commit46d2abf3f700268aa004d6d6ed94b76f65ca914a (patch)
tree1eede77643a1c699cfa858528eacce674436c64f
parent04ed209dc1c3848111e327f437e07db134057cc7 (diff)
downloadansible-46d2abf3f700268aa004d6d6ed94b76f65ca914a.tar.gz
ansible-46d2abf3f700268aa004d6d6ed94b76f65ca914a.tar.xz
ansible-46d2abf3f700268aa004d6d6ed94b76f65ca914a.zip
Show proxy name on varnish errors
-rw-r--r--roles/varnish/tasks/main.yml4
-rw-r--r--roles/varnish/templates/proxy.vcl.j2 (renamed from roles/varnish/files/proxy.vcl)21
2 files changed, 23 insertions, 2 deletions
diff --git a/roles/varnish/tasks/main.yml b/roles/varnish/tasks/main.yml
index a3d46041d..ff62f0178 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
index 464a75468..d9003fcbb 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( {"<!DOCTYPE html>
+<html>
+ <head>
+ <title>"} + resp.status + " " + resp.reason + {"</title>
+ </head>
+ <body>
+ <h1>Error "} + resp.status + " " + resp.reason + {"</h1>
+ <p>"} + resp.reason + {"</p>
+ <h3>Guru Meditation:</h3>
+ <p>XID: "} + req.xid + {"</p>
+ <hr>
+ <p>Varnish cache server on {{ ansible_fqdn }}</p>
+ </body>
+</html>
+"} );
+ return (deliver);
+}
+
sub vcl_recv {
if (req.method == "PURGE") {
if (!client.ip ~ purge) {