DCD-1123: Add nginx server for standalones.

This commit is contained in:
Steve Smith
2020-10-22 12:25:00 +11:00
parent b55dbca2d7
commit 845cced6bb
6 changed files with 64 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
---
atl_proxy_map: {}

View File

@@ -0,0 +1,12 @@
---
- name: Restart nginx
command: systemctl restart nginx.service
ignore_errors: true
- name: Enable nginx
command: systemctl enable nginx.service
ignore_errors: true
- name: Reload systemd units
command: systemctl daemon-reload

View File

@@ -0,0 +1,17 @@
---
- name: Enable nginx from 'extras'
command: amazon-linux-extras install -y "nginx1"
args:
creates: /sbin/nginx
environment:
PYTHON: /bin/python
- name: Reload systemd units
command: systemctl daemon-reload
ignore_errors: true
- name: Enable nginx
command: systemctl enable nginx.service
ignore_errors: true

View File

@@ -0,0 +1,10 @@
---
- name: Install distro-specific prerequisites
include_tasks: "{{ ansible_distribution|lower }}.yml"
- name: Create nginx configuration
template:
src: proxy.conf.j2
dest: /etc/nginx/default.d/proxy.conf
notify: Restart nginx

View File

@@ -0,0 +1,16 @@
{% for ctx, backend in atl_proxy_map.items() %}
location /{{ctx}} {
proxy_pass {{backend}};
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
}
{% endfor %}