Adding capability of pretty error pages (#13852)

Co-authored-by: Jessica Steurer <70719005+jay-steurer@users.noreply.github.com>
This commit is contained in:
John Westcott IV
2023-05-23 13:05:38 -04:00
committed by GitHub
parent 00d8291d40
commit daf39dc77e
9 changed files with 533 additions and 0 deletions

View File

@@ -42,6 +42,16 @@
dest: "{{ sources_dest }}/SECRET_KEY"
no_log: true
- name: Find custom error pages
set_fact:
custom_error_pages: "{{ (custom_error_pages | default([])) + [new_error_page] }}"
vars:
new_error_page:
error_code: "{{ item | basename() | regex_replace('custom_(\\d+).html', '\\1') }}"
web_path: "{{ item | regex_replace('^.*\/static', '/static') }}"
loop: "{{ lookup('ansible.builtin.fileglob', playbook_dir + '/../../../awx/static/custom_*.html', wantlist=True) }}"
when: (item | basename()) is regex("custom_\d+\.html")
- name: Render configuration templates
template:
src: "{{ item }}.j2"

View File

@@ -44,6 +44,11 @@ http {
add_header Strict-Transport-Security max-age=15768000;
add_header X-Content-Type-Options nosniff;
# Pretty error pages
{% for error_page in custom_error_pages %}
error_page {{ error_page.error_code }} {{ error_page.web_path }};
{% endfor %}
include /etc/nginx/conf.d/*.conf;
}
@@ -70,6 +75,10 @@ http {
add_header Strict-Transport-Security max-age=15768000;
add_header X-Content-Type-Options nosniff;
# Pretty error pages
{% for error_page in custom_error_pages %}
error_page {{ error_page.error_code }} {{ error_page.web_path }};
{% endfor %}
include /etc/nginx/conf.d/*.conf;
}