From 39a1b43577fb6e46b7741ed58134731132dca2de Mon Sep 17 00:00:00 2001 From: counterweight Date: Fri, 11 Sep 2026 23:19:01 +0200 Subject: [PATCH] personal-blog: use the caddy_site role First service on the role. 31 lines of copy-pasted Caddy plumbing become 7. Verified: --check before and after the edit reports the same three unrelated tasks as changed, so the edit introduces nothing. Real run leaves all 14 site files on all 3 hosts byte-identical, and the blog still answers HTTP 200. A second consecutive run reports the site task ok with the handler not firing. Side effect worth noting: the playbook no longer has a perpetually-changed task. `command: systemctl reload caddy` always reported changed; the role's handler only fires when the file actually moves. Co-Authored-By: Claude Opus 5 (1M context) --- .../deploy_personal_blog_playbook.yml | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/ansible/services/personal-blog/deploy_personal_blog_playbook.yml b/ansible/services/personal-blog/deploy_personal_blog_playbook.yml index af7a1f3..96d030f 100644 --- a/ansible/services/personal-blog/deploy_personal_blog_playbook.yml +++ b/ansible/services/personal-blog/deploy_personal_blog_playbook.yml @@ -8,7 +8,6 @@ - ./personal_blog_vars.yml vars: personal_blog_subdomain: "{{ subdomains.personal_blog }}" - caddy_sites_dir: "{{ caddy_sites_dir }}" personal_blog_domain: "{{ personal_blog_subdomain }}.{{ root_domain }}" uptime_kuma_api_url: "https://{{ subdomains.uptime_kuma }}.{{ root_domain }}" @@ -51,36 +50,13 @@ group: www-data mode: '0664' - - name: Ensure Caddy sites-enabled directory exists - file: - path: "{{ caddy_sites_dir }}" - state: directory - owner: root - group: root - mode: '0755' - - - name: Ensure Caddyfile includes import directive for sites-enabled - lineinfile: - path: /etc/caddy/Caddyfile - line: 'import sites-enabled/*' - insertafter: EOF - state: present - backup: yes - - - name: Create Caddy file server configuration for personal blog - copy: - dest: "{{ caddy_sites_dir }}/personal-blog.conf" - content: | - {{ personal_blog_domain }} { - root * {{ personal_blog_web_root }} - file_server - } - owner: root - group: root - mode: '0644' - - - name: Reload Caddy to apply new config - command: systemctl reload caddy + - name: Publish the blog through Caddy + ansible.builtin.include_role: + name: caddy_site + vars: + caddy_site_name: personal-blog + caddy_site_domain: "{{ personal_blog_domain }}" + caddy_site_root: "{{ personal_blog_web_root }}" # ═════════════════════════════════════════════════════════════════════════ # DEPRECATED — Uptime Kuma was decommissioned on 2026-09-11.