Allow for the definition of a singular proxy_pass on ingress_servers to simplify configuration

This commit is contained in:
Salt 2021-09-18 07:19:26 -05:00
parent b5057c4064
commit 9b79068380
2 changed files with 18 additions and 31 deletions

View File

@ -55,20 +55,14 @@
ingress_servers: ingress_servers:
# desu.ltd # desu.ltd
- name: desu.ltd - name: desu.ltd
proxies: proxy_pass: http://desultd:80
- location: /
pass: http://desultd:80
- name: git.desu.ltd - name: git.desu.ltd
proxies: proxy_pass: http://gitea:3000
- location: /
pass: http://gitea:3000
- name: nc.desu.ltd - name: nc.desu.ltd
directives: directives:
- "add_header Strict-Transport-Security \"max-age=31536000\"" - "add_header Strict-Transport-Security \"max-age=31536000\""
- "client_max_body_size 0" - "client_max_body_size 0"
proxies: proxy_pass: http://nextcloud:80
- location: /
pass: http://nextcloud:80
locations: locations:
- location: "^~ /.well-known" - location: "^~ /.well-known"
contents: | contents: |
@ -81,13 +75,9 @@
directives: directives:
- "return 301 $scheme://9iron.club$request_uri" - "return 301 $scheme://9iron.club$request_uri"
- name: 9iron.club - name: 9iron.club
proxies: proxy_pass: http://9iron:80
- location: /
pass: http://9iron:80
- name: srv.9iron.club - name: srv.9iron.club
proxies: proxy_pass: http://srv:80
- location: /
pass: http://srv:80
tags: [ web, docker, ingress ] tags: [ web, docker, ingress ]
- hosts: web2.desu.ltd - hosts: web2.desu.ltd
module_defaults: module_defaults:
@ -125,13 +115,9 @@
vars: vars:
ingress_servers: ingress_servers:
- name: cowfee.moe - name: cowfee.moe
proxies: proxy_pass: http://pleroma:4000
- location: /
pass: http://pleroma:4000
- name: tube.cowfee.moe - name: tube.cowfee.moe
proxies: proxy_pass: http://peertube:9000
- location: /
pass: http://peertube:9000
tags: [ web, docker, ingress ] tags: [ web, docker, ingress ]
- hosts: web3.desu.ltd - hosts: web3.desu.ltd
module_defaults: module_defaults:
@ -169,15 +155,9 @@
vars: vars:
ingress_servers: ingress_servers:
- name: netbox.desu.ltd - name: netbox.desu.ltd
proxies: proxy_pass: http://netbox:8080
- location: /
pass: http://netbox:8080
- name: nagios.desu.ltd - name: nagios.desu.ltd
proxies: proxy_pass: http://nagios:80
- location: /
pass: http://nagios:80
- name: movie.desu.ltd - name: movie.desu.ltd
proxies: proxy_pass: http://movienight:8089
- location: /
pass: http://movienight:8089
tags: [ web, docker, ingress ] tags: [ web, docker, ingress ]

View File

@ -22,7 +22,14 @@ server {
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if server.proxies is defined %} {% if server.proxy_pass is defined %}
# Singular proxy_pass
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass {{ server.proxy_pass }};
}
{% elif server.proxies is defined %}
# Proxy locations # Proxy locations
{% for proxy in server.proxies %} {% for proxy in server.proxies %}
location {{ proxy.location }} { location {{ proxy.location }} {