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:
parent
4bee182978
commit
82fca48b08
3 changed files with 25 additions and 108 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
- ./lnbits_vars.yml
|
- ./lnbits_vars.yml
|
||||||
vars:
|
vars:
|
||||||
lnbits_subdomain: "{{ subdomains.lnbits }}"
|
lnbits_subdomain: "{{ subdomains.lnbits }}"
|
||||||
caddy_sites_dir: "{{ caddy_sites_dir }}"
|
|
||||||
lnbits_domain: "{{ lnbits_subdomain }}.{{ root_domain }}"
|
lnbits_domain: "{{ lnbits_subdomain }}.{{ root_domain }}"
|
||||||
uptime_kuma_api_url: "https://{{ subdomains.uptime_kuma }}.{{ root_domain }}"
|
uptime_kuma_api_url: "https://{{ subdomains.uptime_kuma }}.{{ root_domain }}"
|
||||||
|
|
||||||
|
|
@ -147,39 +146,15 @@
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: Ensure Caddy sites-enabled directory exists
|
- name: Publish LNBits through Caddy
|
||||||
file:
|
ansible.builtin.include_role:
|
||||||
path: "{{ caddy_sites_dir }}"
|
name: caddy_site
|
||||||
state: directory
|
vars:
|
||||||
owner: root
|
caddy_site_name: lnbits
|
||||||
group: root
|
caddy_site_domain: "{{ lnbits_domain }}"
|
||||||
mode: '0755'
|
caddy_site_upstream: "localhost:{{ lnbits_port }}"
|
||||||
|
caddy_site_headers_up:
|
||||||
- name: Ensure Caddyfile includes import directive for sites-enabled
|
X-Forwarded-Host: "{{ lnbits_domain }}"
|
||||||
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
|
|
||||||
|
|
||||||
# ═════════════════════════════════════════════════════════════════════════
|
# ═════════════════════════════════════════════════════════════════════════
|
||||||
# DEPRECATED — Uptime Kuma was decommissioned on 2026-09-11.
|
# DEPRECATED — Uptime Kuma was decommissioned on 2026-09-11.
|
||||||
|
|
|
||||||
|
|
@ -166,45 +166,18 @@
|
||||||
- ./memos_vars.yml
|
- ./memos_vars.yml
|
||||||
vars:
|
vars:
|
||||||
memos_subdomain: "{{ subdomains.memos }}"
|
memos_subdomain: "{{ subdomains.memos }}"
|
||||||
caddy_sites_dir: "{{ caddy_sites_dir }}"
|
|
||||||
memos_domain: "{{ memos_subdomain }}.{{ root_domain }}"
|
memos_domain: "{{ memos_subdomain }}.{{ root_domain }}"
|
||||||
uptime_kuma_api_url: "https://{{ subdomains.uptime_kuma }}.{{ root_domain }}"
|
uptime_kuma_api_url: "https://{{ subdomains.uptime_kuma }}.{{ root_domain }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ensure Caddy sites-enabled directory exists
|
- name: Publish Memos through Caddy (via Tailscale)
|
||||||
file:
|
ansible.builtin.include_role:
|
||||||
path: "{{ caddy_sites_dir }}"
|
name: caddy_site
|
||||||
state: directory
|
vars:
|
||||||
owner: root
|
caddy_site_name: memos
|
||||||
group: root
|
caddy_site_domain: "{{ memos_domain }}"
|
||||||
mode: '0755'
|
caddy_site_upstream: "{{ memos_tailscale_hostname }}:{{ memos_port }}"
|
||||||
|
caddy_site_resolvers: "100.100.100.100"
|
||||||
- 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: Create Uptime Kuma monitor setup script for Memos
|
- name: Create Uptime Kuma monitor setup script for Memos
|
||||||
when: uptime_kuma_enabled | default(false)
|
when: uptime_kuma_enabled | default(false)
|
||||||
|
|
|
||||||
|
|
@ -614,47 +614,16 @@
|
||||||
vars:
|
vars:
|
||||||
mempool_subdomain: "{{ subdomains.mempool }}"
|
mempool_subdomain: "{{ subdomains.mempool }}"
|
||||||
mempool_domain: "{{ mempool_subdomain }}.{{ root_domain }}"
|
mempool_domain: "{{ mempool_subdomain }}.{{ root_domain }}"
|
||||||
caddy_sites_dir: "{{ caddy_sites_dir }}"
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ensure Caddy sites-enabled directory exists
|
- name: Publish Mempool through Caddy (via Tailscale)
|
||||||
file:
|
ansible.builtin.include_role:
|
||||||
path: "{{ caddy_sites_dir }}"
|
name: caddy_site
|
||||||
state: directory
|
vars:
|
||||||
owner: root
|
caddy_site_name: mempool
|
||||||
group: root
|
caddy_site_domain: "{{ mempool_domain }}"
|
||||||
mode: '0755'
|
caddy_site_upstream: "mempool-box:{{ mempool_frontend_port }}"
|
||||||
|
caddy_site_resolvers: "100.100.100.100"
|
||||||
- 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: Display Mempool URL
|
- name: Display Mempool URL
|
||||||
when: uptime_kuma_enabled | default(false)
|
when: uptime_kuma_enabled | default(false)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue