roles/caddy: fix issues

This commit is contained in:
dogeystamp 2023-09-03 20:50:07 -04:00
parent e0b7c5a15e
commit a1c44da446
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
4 changed files with 22 additions and 5 deletions

View File

@ -7,3 +7,6 @@
website_path: /srv/http
gitea_domain: "git.{{ domain }}"
## send renewal reminders to this address
email: null

View File

@ -9,6 +9,14 @@
template:
src: Caddyfile.j2
dest: /etc/caddy/Caddyfile
lstrip_blocks: true
register: caddy_config
- name: Restart Caddy service
service:
name: caddy
state: restarted
when: caddy_config.changed
- name: Enable Caddy service
service:

View File

@ -1,12 +1,18 @@
{
{% if email is not none %}
email {{ email }}
{% endif %}
}
{% if "website" in group_names %}
www.{{ domain }} {
http://www.{{ domain }} {
root * {{ website_path }}
file_server
}
{% endif %}
{% if groups["gitea"] %}
{{ gitea_domain }} {
{% if groups["gitea"] | length > 0 %}
http://{{ gitea_domain }} {
reverse_proxy {{ groups["gitea"][0] }}:3000
}
{% endif %}

View File

@ -3,5 +3,5 @@
set -e
git -C /home/{{ web_username }}/website pull
make -C /home/{{ web_username }}/website build
git -C /home/{{ website_username }}/website pull
make -C /home/{{ website_username }}/website build