From 4d35b460ec11c2ed0be0285ef65357a486c7369d Mon Sep 17 00:00:00 2001 From: Tristan Le Guern Date: Tue, 9 Apr 2019 12:40:02 +0100 Subject: [PATCH] Create and populate the errors directory This is taken straight from https://github.com/devops-coop/ansible-haproxy/pull/104. Credits to Reza Jelveh AKA @fishman. --- files/400.http | 9 +++++++++ files/403.http | 9 +++++++++ files/408.http | 9 +++++++++ files/500.http | 9 +++++++++ files/502.http | 9 +++++++++ files/503.http | 9 +++++++++ files/504.http | 9 +++++++++ tasks/configure.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 105 insertions(+) create mode 100644 files/400.http create mode 100644 files/403.http create mode 100644 files/408.http create mode 100644 files/500.http create mode 100644 files/502.http create mode 100644 files/503.http create mode 100644 files/504.http diff --git a/files/400.http b/files/400.http new file mode 100644 index 0000000..e223e38 --- /dev/null +++ b/files/400.http @@ -0,0 +1,9 @@ +HTTP/1.0 400 Bad request +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

400 Bad request

+Your browser sent an invalid request. + + diff --git a/files/403.http b/files/403.http new file mode 100644 index 0000000..a67e807 --- /dev/null +++ b/files/403.http @@ -0,0 +1,9 @@ +HTTP/1.0 403 Forbidden +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

403 Forbidden

+Request forbidden by administrative rules. + + diff --git a/files/408.http b/files/408.http new file mode 100644 index 0000000..aafb130 --- /dev/null +++ b/files/408.http @@ -0,0 +1,9 @@ +HTTP/1.0 408 Request Time-out +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

408 Request Time-out

+Your browser didn't send a complete request in time. + + diff --git a/files/500.http b/files/500.http new file mode 100644 index 0000000..bb121e8 --- /dev/null +++ b/files/500.http @@ -0,0 +1,9 @@ +HTTP/1.0 500 Server Error +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

500 Server Error

+An internal server error occured. + + diff --git a/files/502.http b/files/502.http new file mode 100644 index 0000000..94b35d4 --- /dev/null +++ b/files/502.http @@ -0,0 +1,9 @@ +HTTP/1.0 502 Bad Gateway +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

502 Bad Gateway

+The server returned an invalid or incomplete response. + + diff --git a/files/503.http b/files/503.http new file mode 100644 index 0000000..48fde58 --- /dev/null +++ b/files/503.http @@ -0,0 +1,9 @@ +HTTP/1.0 503 Service Unavailable +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

503 Service Unavailable

+No server is available to handle this request. + + diff --git a/files/504.http b/files/504.http new file mode 100644 index 0000000..f925184 --- /dev/null +++ b/files/504.http @@ -0,0 +1,9 @@ +HTTP/1.0 504 Gateway Time-out +Cache-Control: no-cache +Connection: close +Content-Type: text/html + +

504 Gateway Time-out

+The server didn't respond in time. + + diff --git a/tasks/configure.yml b/tasks/configure.yml index 4d9042d..a6df105 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -138,6 +138,48 @@ with_items: "{{ haproxy_userlists }}" when: haproxy_userlists is defined +## CREATE ERROR PAGES + +- name: Add error directory + file: + path: "{{ haproxy_config_dir }}/errors" + state: directory + +- name: Ensure http 400 error file is present + copy: + src: 400.http + dest: "{{ haproxy_config_dir }}/errors/400.http" + +- name: Ensure http 403 error file is present + copy: + src: 403.http + dest: "{{ haproxy_config_dir }}/errors/403.http" + +- name: Ensure http 408 error file is present + copy: + src: 408.http + dest: "{{ haproxy_config_dir }}/errors/408.http" + +- name: Ensure http 500 error file is present + copy: + src: 500.http + dest: "{{ haproxy_config_dir }}/errors/500.http" + +- name: Ensure http 502 error file is present + copy: + src: 502.http + dest: "{{ haproxy_config_dir }}/errors/502.http" + +- name: Ensure http 503 error file is present + copy: + src: 503.http + dest: "{{ haproxy_config_dir }}/errors/503.http" + +- name: Ensure http 504 error file is present + copy: + src: 504.http + dest: "{{ haproxy_config_dir }}/errors/504.http" + ## ASSEMBLE CONFIG - GLOBAL & DEFAULT - name: 'Delete the compiled folder'