Merge branch 'master' of git.uumas.fi:uumas/ansible-general

This commit is contained in:
uumas
2022-01-08 01:10:21 +02:00
8 changed files with 38 additions and 4 deletions

View File

@@ -2,6 +2,12 @@
These variables might be required by multiple roles and need to be defined. Example values below.
```
email: 'admin@domain.tld'
admin_email: 'admin@domain.tld'
```
# Optional variables
These variables are used by multiple roles and have the following default values:
```
reverse_proxy_type: caddy # Allowed values: caddy, none

View File

@@ -2,7 +2,7 @@
namespace: uumas
name: general
version: 0.4.1
version: 0.5.0
readme: README.md
authors:
- uumas

View File

@@ -26,7 +26,7 @@
blockinfile:
path: /etc/caddy/Caddyfile
marker: "{mark}"
marker_begin: ':80'
marker_begin: ':80 {'
marker_end: '# https://caddyserver.com/docs/caddyfile'
state: absent
validate: 'caddy validate --config %s --adapter caddyfile'
@@ -38,7 +38,7 @@
marker: "# {mark} ANSIBLE MANAGED BLOCK general"
block: |
{
email {{ email }}
email {{ admin_email }}
}
validate: 'caddy validate --config %s --adapter caddyfile'
backup: yes

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'