This commit is contained in:
2025-11-28 15:32:48 +01:00
parent 26a3000e88
commit b7b2b31b80
6 changed files with 69 additions and 38 deletions

View File

@@ -0,0 +1,9 @@
caddy_email: "admin@example.com"
portal_domain: "portal.example.com"
nextcloud_domain: "nextcloud.example.net"
nextcloud_target: "10.0.10.12:80"
gitea_domain: "git.example.net"
gitea_target: "10.0.10.13:3000"

View File

@@ -0,0 +1,11 @@
---
- name: reload systemd
command: systemctl daemon-reload
- name: restart caddy-portal
systemd:
name: caddy-portal
state: restarted
- name: reload caddy
command: caddy reload --config /etc/caddy/Caddyfile

View File

@@ -12,7 +12,7 @@
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"] when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- ansible.builtin.import_tasks: caddy_config.yml - ansible.builtin.import_tasks: caddy_config.yml
- ansible.builtin.import_tasks: caddy_service.yml - ansible.builtin.import_tasks: caddy_service.yml
- ansible.builtin.import_tasks: install_caddy_portal.yml
rescue: rescue:
- set_fact: task_failed=true - set_fact: task_failed=true

View File

@@ -1,37 +0,0 @@
---
- name: Install dependencies
apt:
name:
- curl
- unzip
- git
- build-essential
state: present
update_cache: yes
- name: Download xcaddy
get_url:
url: https://github.com/caddyserver/xcaddy/releases/download/v0.9.5/xcaddy_0.9.5_linux_amd64.tar.gz
dest: /tmp/xcaddy.tar.gz
- name: Extract xcaddy
unarchive:
src: /tmp/xcaddy.tar.gz
dest: /usr/local/bin/
mode: 0755
remote_src: yes
- name: Build Caddy with PowerDNS DNS plugin
command: >
xcaddy build
--with github.com/caddy-dns/powerdns
args:
chdir: /usr/local/bin
creates: /usr/local/bin/caddy-custom
- name: Move custom caddy binary
copy:
src: /usr/local/bin/caddy
dest: /usr/local/bin/caddy
mode: 0755
remote_src: yes

View File

@@ -0,0 +1,34 @@
---
- name: Create caddy-portal directory
file:
path: /opt/caddy-portal
state: directory
owner: root
group: root
mode: '0755'
- name: Download caddy-portal installer
get_url:
url: "https://github.com/caddy-portal/caddy-portal/releases/latest/download/install.sh"
dest: /opt/caddy-portal/install.sh
mode: "0755"
- name: Run caddy-portal installer
command: bash /opt/caddy-portal/install.sh
args:
creates: /usr/local/bin/caddy-portal
register: portal_install
- name: Install systemd service for caddy-portal
template:
src: caddy-portal.service.j2
dest: /etc/systemd/system/caddy-portal.service
notify:
- reload systemd
- restart caddy-portal
- name: Enable caddy-portal
systemd:
name: caddy-portal
enabled: true
state: started

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Caddy Portal
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/local/bin/caddy-portal server
Restart=always
RestartSec=5
User=root
WorkingDirectory=/opt/caddy-portal
[Install]
WantedBy=multi-user.target