reverse_proxy role

This commit is contained in:
uumas
2021-12-20 04:37:09 +02:00
parent 9bae204060
commit f0b0d7c66c
7 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1 @@
Sets up a reverse proxy defined by the `reverse_proxy_type` variable

View File

@@ -0,0 +1,3 @@
---
reverse_proxy_type: caddy

View File

@@ -0,0 +1,5 @@
---
dependencies:
- role: caddy
when: reverse_proxy_type == 'caddy'

View File

@@ -0,0 +1,14 @@
---
- name: Add caddy reverse proxy config
blockinfile:
path: /etc/caddy/Caddyfile
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ vhost_id }}"
block: |
{{ vhost_domains | join(' ') }} {
reverse_proxy {{ proxy_target }}
}
validate: 'caddy validate --config %s --adapter caddyfile'
backup: true
notify: reload caddy

View File

@@ -0,0 +1,5 @@
---
- name: Setup {{ vhost_id }} reverse proxy
include_tasks: "{{ reverse_proxy_type }}.yml"
when: reverse_proxy_type != 'none'