lnbits, memos, mempool: use the caddy_site role

lnbits is the header_up shape; memos and mempool are the Tailscale MagicDNS
shape. 108 lines removed, 25 added.

mempool was the one playbook already reloading Caddy correctly
(systemd: state: reloaded rather than command: systemctl reload caddy), so
its end marker differed - the role's handler does the same thing.

Verified:
  - lnbits: full --check, site task ok, byte-identical to the live file
  - memos, mempool: --check --diff via --limit edge shows exactly one added
    line each, the standardised MagicDNS comment. Both playbooks fail earlier
    in check mode on their VM play ("Extract memos binary", the same
    download-does-not-happen-in-check-mode artifact as forgejo), but the edits
    are confined to the hosts: edge play - memos at line 169+, play 2 starts
    at 159; mempool at 617+, play 2 starts at 606.

The added comment means the next real run of memos/mempool rewrites one
comment line. Those two host files were already stale against their
playbooks before this change.

All 14 site files on all 3 hosts still byte-identical.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
counterweight 2026-09-11 23:29:06 +02:00
parent 4bee182978
commit 82fca48b08
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 25 additions and 108 deletions

View file

@ -8,7 +8,6 @@
- ./lnbits_vars.yml
vars:
lnbits_subdomain: "{{ subdomains.lnbits }}"
caddy_sites_dir: "{{ caddy_sites_dir }}"
lnbits_domain: "{{ lnbits_subdomain }}.{{ root_domain }}"
uptime_kuma_api_url: "https://{{ subdomains.uptime_kuma }}.{{ root_domain }}"
@ -147,39 +146,15 @@
enabled: yes
state: started
- 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
create: yes
mode: '0644'
- name: Create Caddy reverse proxy configuration for lnbits
copy:
dest: "{{ caddy_sites_dir }}/lnbits.conf"
content: |
{{ lnbits_domain }} {
reverse_proxy localhost:{{ lnbits_port }} {
header_up X-Forwarded-Host {{ lnbits_domain }}
}
}
owner: root
group: root
mode: '0644'
- name: Reload Caddy to apply new config
command: systemctl reload caddy
- name: Publish LNBits through Caddy
ansible.builtin.include_role:
name: caddy_site
vars:
caddy_site_name: lnbits
caddy_site_domain: "{{ lnbits_domain }}"
caddy_site_upstream: "localhost:{{ lnbits_port }}"
caddy_site_headers_up:
X-Forwarded-Host: "{{ lnbits_domain }}"
# ═════════════════════════════════════════════════════════════════════════
# DEPRECATED — Uptime Kuma was decommissioned on 2026-09-11.

View file

@ -166,45 +166,18 @@
- ./memos_vars.yml
vars:
memos_subdomain: "{{ subdomains.memos }}"
caddy_sites_dir: "{{ caddy_sites_dir }}"
memos_domain: "{{ memos_subdomain }}.{{ root_domain }}"
uptime_kuma_api_url: "https://{{ subdomains.uptime_kuma }}.{{ root_domain }}"
tasks:
- 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 reverse proxy configuration for memos (via Tailscale)
copy:
dest: "{{ caddy_sites_dir }}/memos.conf"
content: |
{{ memos_domain }} {
reverse_proxy {{ memos_tailscale_hostname }}:{{ memos_port }} {
# Use Tailscale MagicDNS to resolve the upstream hostname
transport http {
resolvers 100.100.100.100
}
}
}
owner: root
group: root
mode: '0644'
- name: Reload Caddy to apply new config
command: systemctl reload caddy
- name: Publish Memos through Caddy (via Tailscale)
ansible.builtin.include_role:
name: caddy_site
vars:
caddy_site_name: memos
caddy_site_domain: "{{ memos_domain }}"
caddy_site_upstream: "{{ memos_tailscale_hostname }}:{{ memos_port }}"
caddy_site_resolvers: "100.100.100.100"
- name: Create Uptime Kuma monitor setup script for Memos
when: uptime_kuma_enabled | default(false)

View file

@ -614,47 +614,16 @@
vars:
mempool_subdomain: "{{ subdomains.mempool }}"
mempool_domain: "{{ mempool_subdomain }}.{{ root_domain }}"
caddy_sites_dir: "{{ caddy_sites_dir }}"
tasks:
- 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
create: yes
mode: '0644'
- name: Create Caddy reverse proxy configuration for Mempool
copy:
dest: "{{ caddy_sites_dir }}/mempool.conf"
content: |
{{ mempool_domain }} {
reverse_proxy mempool-box:{{ mempool_frontend_port }} {
# Use Tailscale MagicDNS to resolve the upstream hostname
transport http {
resolvers 100.100.100.100
}
}
}
owner: root
group: root
mode: '0644'
- name: Reload Caddy to apply new config
systemd:
name: caddy
state: reloaded
- name: Publish Mempool through Caddy (via Tailscale)
ansible.builtin.include_role:
name: caddy_site
vars:
caddy_site_name: mempool
caddy_site_domain: "{{ mempool_domain }}"
caddy_site_upstream: "mempool-box:{{ mempool_frontend_port }}"
caddy_site_resolvers: "100.100.100.100"
- name: Display Mempool URL
when: uptime_kuma_enabled | default(false)