add site-available template
This commit is contained in:
parent
c2e78ea874
commit
e2bf5e9529
3 changed files with 42 additions and 0 deletions
|
@ -7,3 +7,9 @@
|
||||||
register: apt_result
|
register: apt_result
|
||||||
retries: 3
|
retries: 3
|
||||||
until: apt_result is succeeded
|
until: apt_result is succeeded
|
||||||
|
|
||||||
|
- name: Copy reverse proxy sites
|
||||||
|
template:
|
||||||
|
src: "nginx/sites-available/reverse_proxy"
|
||||||
|
dest: "/etc/nginx/sites-available/{{ item.from }}"
|
||||||
|
loop: "{{ reverse_proxy_sites }}"
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
server_name {{ item.from }};
|
||||||
|
# Redirect to https
|
||||||
|
location / {
|
||||||
|
return 302 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
listen [::]:443 ssl http2;
|
||||||
|
|
||||||
|
server_name {{ item.from }};
|
||||||
|
|
||||||
|
# SSL common conf
|
||||||
|
include "/etc/nginx/snippets/options-ssl.conf";
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
access_log /var/log/nginx/{{ item.from }}.log;
|
||||||
|
error_log /var/log/nginx/{{ item.from }}_error.log;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass {{ item.to }};
|
||||||
|
include "/etc/nginx/snippets/options-proxypass.conf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,3 +5,7 @@
|
||||||
- hosts: hindley.adh.auro.re
|
- hosts: hindley.adh.auro.re
|
||||||
roles:
|
roles:
|
||||||
- reverse_proxy
|
- reverse_proxy
|
||||||
|
vars:
|
||||||
|
reverse_proxy_sites:
|
||||||
|
- {from: wiki.pains-perdus.fr, to: "https://azerty.fil.sand.auro.re:2443"}
|
||||||
|
- {from: hindley.pains-perdus.fr, to: "http://127.0.0.1:5000"}
|
||||||
|
|
Loading…
Reference in a new issue