Added role pve-nginx-redirector
roles: - pve-nginx-redirector For a more admin friedly workflow this patch configures nginx to redirect everything http://:80 and https://:443 to https://:8006 using pve's own self-signed certificates for https://
This commit is contained in:
parent
16bd6ae321
commit
e916da0667
4
roles/pve-nginx-redirector/handlers/main.yml
Normal file
4
roles/pve-nginx-redirector/handlers/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Restart nginx
|
||||||
|
service: name=nginx state=restarted
|
10
roles/pve-nginx-redirector/tasks/main.yml
Normal file
10
roles/pve-nginx-redirector/tasks/main.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Check if nginx is installed
|
||||||
|
stat: path=/etc/nginx
|
||||||
|
register: nginx
|
||||||
|
|
||||||
|
- name: Configuring nginx pve redirector 80 -> 443 -> 8006
|
||||||
|
template: src=redirect.j2 dest=/etc/nginx/sites-enabled/redirect mode=0644
|
||||||
|
notify: Restart nginx
|
||||||
|
when: nginx.stat.exists == True
|
19
roles/pve-nginx-redirector/templates/redirect.j2
Normal file
19
roles/pve-nginx-redirector/templates/redirect.j2
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
server {
|
||||||
|
listen {{ ansible_default_ipv4.address | default("0.0.0.0") }}:80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$server_addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen {{ ansible_default_ipv4.address | default("0.0.0.0") }}:443 ssl;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$server_addr:8006;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssl_certificate /etc/pve/local/pve-ssl.pem;
|
||||||
|
ssl_certificate_key /etc/pve/local/pve-ssl.key;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user