57 lines
2 KiB
YAML
57 lines
2 KiB
YAML
|
|
---
|
||
|
|
# Everything here answers "is bitcoind healthy" and records the answer. The
|
||
|
|
# Uptime Kuma specifics that used to follow — an embedded Python script creating
|
||
|
|
# monitors over the API, a /tmp credentials file, push-URL extraction and a
|
||
|
|
# systemd Environment= rewrite — are gone. Where it reports is now one variable,
|
||
|
|
# healthcheck_push_url. See the role README.
|
||
|
|
- name: Install curl for health check script
|
||
|
|
apt:
|
||
|
|
name: curl
|
||
|
|
state: present
|
||
|
|
|
||
|
|
- name: Create Bitcoin Knots health check script
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: healthcheck.sh.j2
|
||
|
|
dest: /usr/local/bin/bitcoin-knots-healthcheck-push.sh
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0755'
|
||
|
|
validate: "bash -n %s"
|
||
|
|
|
||
|
|
- name: Create systemd service for Bitcoin Knots health check
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: healthcheck.service.j2
|
||
|
|
dest: /etc/systemd/system/bitcoin-knots-healthcheck.service
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0644'
|
||
|
|
|
||
|
|
- name: Create systemd timer for Bitcoin Knots health check
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: healthcheck.timer.j2
|
||
|
|
dest: /etc/systemd/system/bitcoin-knots-healthcheck.timer
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0644'
|
||
|
|
|
||
|
|
- name: Reload systemd daemon for health check
|
||
|
|
systemd:
|
||
|
|
daemon_reload: yes
|
||
|
|
|
||
|
|
- name: Enable and restart the Bitcoin Knots health check timer
|
||
|
|
systemd:
|
||
|
|
name: bitcoin-knots-healthcheck.timer
|
||
|
|
enabled: yes
|
||
|
|
state: restarted
|
||
|
|
daemon_reload: yes
|
||
|
|
|
||
|
|
# Runs the check once, which is both a smoke test and the thing that actually
|
||
|
|
# arms the timer. This timer is OnBootSec + OnUnitActiveSec with no OnCalendar:
|
||
|
|
# OnBootSec elapses once, and OnUnitActiveSec needs the SERVICE to have run this
|
||
|
|
# boot to have anything to schedule from. Restarting the timer does not supply
|
||
|
|
# that reference; running the service does. The live timer had last fired on
|
||
|
|
# 2026-08-09 while still reporting `active` and `enabled`.
|
||
|
|
- name: Run the Bitcoin Knots health check once to arm the timer
|
||
|
|
command: systemctl start bitcoin-knots-healthcheck.service
|
||
|
|
changed_when: false
|