59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
|
|
---
|
||
|
|
# Three checks, one per moving part. The Uptime Kuma specifics that used to
|
||
|
|
# follow — an embedded Python script creating monitors over the API, a /tmp
|
||
|
|
# credentials file, a push-URL file read back and parsed, and three systemd
|
||
|
|
# Environment= rewrites — are gone. Where each reports is now hc.push_url.
|
||
|
|
- name: Create Mempool health check scripts
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: "healthcheck-{{ hc.name }}.sh.j2"
|
||
|
|
dest: "/usr/local/bin/mempool-{{ hc.name }}-healthcheck-push.sh"
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0755'
|
||
|
|
validate: "bash -n %s"
|
||
|
|
loop: "{{ mempool_healthchecks }}"
|
||
|
|
loop_control:
|
||
|
|
loop_var: hc
|
||
|
|
label: "{{ hc.name }}"
|
||
|
|
|
||
|
|
- name: Create systemd services for health checks
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: healthcheck.service.j2
|
||
|
|
dest: "/etc/systemd/system/mempool-{{ hc.name }}-healthcheck.service"
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0644'
|
||
|
|
loop: "{{ mempool_healthchecks }}"
|
||
|
|
loop_control:
|
||
|
|
loop_var: hc
|
||
|
|
label: "{{ hc.name }}"
|
||
|
|
|
||
|
|
- name: Create systemd timers for health checks
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: healthcheck.timer.j2
|
||
|
|
dest: "/etc/systemd/system/mempool-{{ hc.name }}-healthcheck.timer"
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0644'
|
||
|
|
loop: "{{ mempool_healthchecks }}"
|
||
|
|
loop_control:
|
||
|
|
loop_var: hc
|
||
|
|
label: "{{ hc.name }}"
|
||
|
|
|
||
|
|
- name: Reload systemd daemon
|
||
|
|
systemd:
|
||
|
|
daemon_reload: yes
|
||
|
|
|
||
|
|
# Ungated on purpose: enabling a timer is deployment, not monitoring. The
|
||
|
|
# deprecation banner swept this up with the push plumbing, so Ansible stopped
|
||
|
|
# managing three timers that are in fact running on the host.
|
||
|
|
- name: Enable and start health check timers
|
||
|
|
systemd:
|
||
|
|
name: "mempool-{{ hc.name }}-healthcheck.timer"
|
||
|
|
enabled: yes
|
||
|
|
state: started
|
||
|
|
loop: "{{ mempool_healthchecks }}"
|
||
|
|
loop_control:
|
||
|
|
loop_var: hc
|
||
|
|
label: "{{ hc.name }}"
|