55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
|
|
---
|
||
|
|
# "Does the explorer actually serve a page", as opposed to infra/401's "is the
|
||
|
|
# unit active". xmrblocks can be perfectly `active` and still fail every
|
||
|
|
# request - a missing templates directory does exactly that.
|
||
|
|
|
||
|
|
- name: Install the health check's dependencies
|
||
|
|
apt:
|
||
|
|
name:
|
||
|
|
- curl
|
||
|
|
state: present
|
||
|
|
|
||
|
|
- name: Create the xmrblocks health check script
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: healthcheck.sh.j2
|
||
|
|
dest: /usr/local/bin/xmrblocks-healthcheck-push.sh
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0755'
|
||
|
|
validate: "bash -n %s"
|
||
|
|
|
||
|
|
# 0600: carries the Gatus bearer token.
|
||
|
|
- name: Create the xmrblocks health check systemd service
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: healthcheck.service.j2
|
||
|
|
dest: /etc/systemd/system/xmrblocks-healthcheck.service
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0600'
|
||
|
|
notify: Restart xmrblocks health check timer
|
||
|
|
|
||
|
|
- name: Create the xmrblocks health check systemd timer
|
||
|
|
ansible.builtin.template:
|
||
|
|
src: healthcheck.timer.j2
|
||
|
|
dest: /etc/systemd/system/xmrblocks-healthcheck.timer
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: '0644'
|
||
|
|
notify: Restart xmrblocks health check timer
|
||
|
|
|
||
|
|
- name: Reload systemd daemon after health check units
|
||
|
|
systemd:
|
||
|
|
daemon_reload: yes
|
||
|
|
|
||
|
|
# Ungated: enabling a timer is deployment, not monitoring.
|
||
|
|
- name: Enable and restart the xmrblocks health check timer
|
||
|
|
systemd:
|
||
|
|
name: xmrblocks-healthcheck.timer
|
||
|
|
enabled: yes
|
||
|
|
state: restarted
|
||
|
|
daemon_reload: yes
|
||
|
|
|
||
|
|
- name: Run the xmrblocks health check once to arm the timer
|
||
|
|
ansible.builtin.command: systemctl start xmrblocks-healthcheck.service
|
||
|
|
changed_when: false
|