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) <noreply@anthropic.com>
This commit is contained in:
parent
cc9340b7cc
commit
39a1b43577
1 changed files with 7 additions and 31 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue