Add possibility to configure port forwarding, like SSH for Gitea

This commit is contained in:
Yohann D'ANELLO 2020-11-04 23:49:35 +01:00
parent 9de65d2574
commit 03d48a2d82
4 changed files with 36 additions and 0 deletions

View file

@ -27,6 +27,11 @@ nginx:
- aurores.net - aurores.net
- fede-aurore.net - fede-aurore.net
redirect_tcp:
- name: Gitea
port: 2222
destination: "10.128.0.60:2222"
redirect_sites: {} redirect_sites: {}
reverseproxy_sites: reverseproxy_sites:

View file

@ -30,6 +30,8 @@ nginx:
- aurores.net - aurores.net
- fede-aurore.net - fede-aurore.net
redirect_tcp: {}
redirect_sites: redirect_sites:
- from: auro.re - from: auro.re
to: www.auro.re to: www.auro.re

View file

@ -45,6 +45,21 @@
- redirect - redirect
notify: Reload nginx notify: Reload nginx
- name: Copy forward modules
template:
src: "nginx/modules-available/60-forward.conf.j2"
dest: "/etc/nginx/modules-available/60-forward.conf"
mode: 0644
notify: Reload nginx
- name: Activate modules
file:
src: "/etc/nginx/modules-available/60-forward.conf"
dest: "/etc/nginx/modules-enabled/60-forward.conf"
state: link
mode: 0644
notify: Reload nginx
- name: Copy 50x error page - name: Copy 50x error page
template: template:
src: www/html/50x.html.j2 src: www/html/50x.html.j2

View file

@ -0,0 +1,14 @@
# {{ ansible_managed }}
{% for site in nginx.redirect_tcp %}
# Forward port {{ site.port }} to {{ site.name }}
stream {
server {
listen {{ site.port }};
listen [::]:{{ site.port }};
proxy_pass {{ site.destination }};
}
}
{% endfor %}