Add Sigvild Gallery wedding photo application with automated deployment and improve Caddy plugin management

This commit is contained in:
2025-11-15 16:13:18 +01:00
parent 8162e789ee
commit 7c3b02e5ad
16 changed files with 923 additions and 10 deletions

View File

@@ -3,19 +3,35 @@
set_fact:
dns_challenge_needed: "{{ caddy_dns_provider == 'cloudflare' and cloudflare_api_token != '' }}"
- name: Check if Caddy is already installed
command: /usr/bin/caddy version
register: caddy_version_check
failed_when: false
changed_when: false
when: dns_challenge_needed | bool
- name: Check if installed Caddy has Cloudflare plugin
command: /usr/bin/caddy list-modules --packages
register: caddy_modules_check
failed_when: false
changed_when: false
when: dns_challenge_needed | bool and caddy_version_check.rc == 0
- name: Install standard Caddy (if no DNS challenge needed)
pacman:
name: caddy
state: present
when: not dns_challenge_needed | bool
when: not dns_challenge_needed and not caddy_version_check | bool
notify: restart caddy
- name: Download Caddy with Cloudflare plugin (if DNS challenge needed)
get_url:
url: "https://caddyserver.com/api/download?os=linux&arch=amd64&p=github.com/caddy-dns/cloudflare"
dest: /tmp/caddy-with-cloudflare
mode: '0755'
when: dns_challenge_needed | bool
url: "https://caddyserver.com/api/download?os=linux&arch=amd64&p=github.com/caddy-dns/cloudflare"
dest: /tmp/caddy-with-cloudflare
mode: '0755'
when:
- dns_challenge_needed | bool
- caddy_version_check.rc != 0 or 'github.com/caddy-dns/cloudflare' not in caddy_modules_check.stdout | default('')
- name: Install Caddy with Cloudflare plugin
copy:
@@ -24,7 +40,7 @@
mode: '0755'
remote_src: yes
backup: yes
when: dns_challenge_needed | bool
when: dns_challenge_needed and caddy_version_check | bool
notify: restart caddy
- name: Clean up temporary Caddy binary