boost-proxy: custom error pages are optional
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
This commit is contained in:
parent
c0e0ba3562
commit
c28cb1ee72
|
@ -23,7 +23,7 @@
|
|||
# Sites configuration
|
||||
######################
|
||||
|
||||
- include_tasks: sites.yml
|
||||
- import_tasks: sites.yml
|
||||
|
||||
#################
|
||||
# external roles
|
||||
|
@ -45,4 +45,4 @@
|
|||
# validations
|
||||
##############
|
||||
|
||||
- include_tasks: validate.yml
|
||||
- include: validate.yml
|
||||
|
|
33
boost-proxy/tasks/site.yml
Normal file
33
boost-proxy/tasks/site.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
|
||||
# HAProxy
|
||||
|
||||
- name: "Copy custom error pages for {{ site }}"
|
||||
template:
|
||||
src: "{{ template }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
loop: "{{ query('fileglob', 'templates/boost-sites/{{ site }}/haproxy/*.http') }}"
|
||||
loop_control:
|
||||
loop_var: template
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
# Varnish
|
||||
|
||||
- name: "Copy sites custom VCL config for {{ site }}"
|
||||
template:
|
||||
src: "templates/boost-sites/{{ site }}/varnish/default.vcl.j2"
|
||||
dest: "/etc/varnish/sites/{{ site }}.vcl"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: reload varnish
|
||||
tags:
|
||||
- varnish
|
||||
- config
|
||||
- update-config
|
|
@ -14,171 +14,6 @@
|
|||
- config
|
||||
- update-config
|
||||
|
||||
- name: Create sites directories
|
||||
file:
|
||||
dest: "/etc/haproxy/sites/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
state: directory
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy maintenance page
|
||||
template:
|
||||
src: "{{ lookup('first_found', file) }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/maintenance.http"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
vars:
|
||||
file:
|
||||
- "templates/boost-sites/{{ site }}/haproxy/maintenance.http"
|
||||
- "templates/haproxy/maintenance.http"
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy 504 page
|
||||
template:
|
||||
src: "{{ lookup('first_found', file, errors='ignore') }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/504.http"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
vars:
|
||||
file:
|
||||
- "templates/boost-sites/{{ site }}/haproxy/504.http"
|
||||
- "templates/haproxy/504.http"
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy 503 page
|
||||
template:
|
||||
src: "{{ lookup('first_found', file, errors='ignore') }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/503.http"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
vars:
|
||||
file:
|
||||
- "templates/boost-sites/{{ site }}/haproxy/503.http"
|
||||
- "templates/haproxy/503.http"
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy 502 page
|
||||
template:
|
||||
src: "{{ lookup('first_found', file, errors='ignore') }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/502.http"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
vars:
|
||||
file:
|
||||
- "templates/boost-sites/{{ site }}/haproxy/502.http"
|
||||
- "templates/haproxy/502.http"
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy 500 page
|
||||
template:
|
||||
src: "{{ lookup('first_found', file) }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/500.http"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
vars:
|
||||
file:
|
||||
- "templates/boost-sites/{{ site }}/haproxy/500.http"
|
||||
- "templates/haproxy/500.http"
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy 400 page
|
||||
template:
|
||||
src: "{{ lookup('first_found', file) }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/400.http"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
vars:
|
||||
file:
|
||||
- "templates/boost-sites/{{ site }}/haproxy/400.http"
|
||||
- "templates/haproxy/400.http"
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy 403 page
|
||||
template:
|
||||
src: "{{ lookup('first_found', file) }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/403.http"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
vars:
|
||||
file:
|
||||
- "templates/boost-sites/{{ site }}/haproxy/403.http"
|
||||
- "templates/haproxy/403.http"
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy 404 page
|
||||
template:
|
||||
src: "{{ lookup('first_found', file) }}"
|
||||
dest: "/etc/haproxy/sites/{{ site }}/404.http"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
vars:
|
||||
file:
|
||||
- "templates/boost-sites/{{ site }}/haproxy/404.http"
|
||||
- "templates/haproxy/404.http"
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
tags:
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
||||
# Varnish
|
||||
|
||||
- name: Create sites parent directory
|
||||
|
@ -193,18 +28,16 @@
|
|||
- config
|
||||
- update-config
|
||||
|
||||
- name: Copy sites custom VCL
|
||||
template:
|
||||
src: "templates/boost-sites/{{ site }}/varnish/default.vcl.j2"
|
||||
dest: "/etc/varnish/sites/{{ site }}.vcl"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
# Each site
|
||||
|
||||
- name: Create site configuration
|
||||
include: site.yml
|
||||
loop: "{{ boost_sites_enabled }}"
|
||||
loop_control:
|
||||
loop_var: site
|
||||
notify: reload varnish
|
||||
when:
|
||||
- boost_sites_enabled | length > 0
|
||||
tags:
|
||||
- varnish
|
||||
- haproxy
|
||||
- config
|
||||
- update-config
|
||||
|
|
Loading…
Reference in a new issue