2024-02-17 11:00:06 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Check params
|
|
|
|
ansible.builtin.assert:
|
|
|
|
that:
|
|
|
|
- not(tls.type == "cloudflare" and tls.cloudflare_token is undefined)
|
|
|
|
- not(tls.type == "file" and (tls.cert is undefined or tls.key is undefined))
|
|
|
|
- tls.type is not defined or (tls.type in ['auto', 'internal', 'cloudflare', 'file'] )
|
|
|
|
|
|
|
|
- name: Set up Caddy
|
2024-02-19 10:56:04 +02:00
|
|
|
ansible.builtin.include_role:
|
2024-02-17 11:00:06 +02:00
|
|
|
name: reverse-proxy
|
|
|
|
|
|
|
|
- name: Template vhost file
|
|
|
|
ansible.builtin.template:
|
2024-02-18 09:52:10 +02:00
|
|
|
src: "{{ template_file | default('vhost.caddy.j2') }}"
|
2024-02-17 11:00:06 +02:00
|
|
|
dest: "/etc/caddy/sites-available/{{ app_name }}.caddy"
|
2024-02-19 10:56:04 +02:00
|
|
|
mode: "644"
|
2024-02-17 11:00:06 +02:00
|
|
|
|
|
|
|
- name: Symlink vhost
|
|
|
|
ansible.builtin.file:
|
|
|
|
src: "/etc/caddy/sites-available/{{ app_name }}.caddy"
|
|
|
|
dest: "/etc/caddy/sites-enabled/{{ app_name }}.caddy"
|
|
|
|
state: link
|
|
|
|
notify: Reload Caddy
|