Add Uptime Kuma monitoring configuration options

This commit is contained in:
Emiel Molenaar 2026-01-05 21:52:40 +01:00
parent 51e099e553
commit 9209da9af1
5 changed files with 75 additions and 0 deletions

View File

@ -16,6 +16,25 @@
borg_group: backupuser
```
## Using Uptime Kuma for Backup Monitoring
```
- hosts: webservers
roles:
- role: borgbase.ansible_role_borgbackup
borg_encryption_passphrase: CHANGEME
borg_repository: ssh://m5vz9gp4@m5vz9gp4.repo.borgbase.com/./repo
borgmatic_timer: systemd
borg_source_directories:
- /var/www
borgmatic_uptime_kuma_push_url: "https://example.uptime.kuma/api/push/abcd1234"
borgmatic_uptime_kuma_states:
- start
- finish
- fail
borgmatic_uptime_kuma_verify_tls: true
```
## Use service user and copy SSH key to target server
Installs and configures the Borgmatic client and also initializes the repo on the

View File

@ -121,6 +121,9 @@ $ git clone https://github.com/borgbase/ansible-role-borgbackup.git roles/ansibl
- `borgmatic_store_atime`: Store atime into archive. Defaults to `true`
- `borgmatic_store_ctime`: Store ctime into archive. Defaults to `true`
- `borgmatic_version`: Force a specific borgmatic version to be installed
- `borgmatic_uptime_kuma_push_url`: Uptime Kuma push URL for monitoring (without query string). See [Uptime Kuma documentation](https://torsion.org/borgmatic/reference/configuration/monitoring/uptime-kuma/) for more. Example: `https://example.uptime.kuma/api/push/abcd1234`
- `borgmatic_uptime_kuma_states`: List of monitoring states to push for. Defaults to `['start', 'finish', 'fail']`. Valid values are: `start`, `finish`, and `fail`.
- `borgmatic_uptime_kuma_verify_tls`: Verify the TLS certificate of the push URL host. Defaults to `true`
- `borg_user`: Name of the User to create Backups (service account)
- `borg_group`: Name of the Group to create Backups (service account)

View File

@ -47,6 +47,14 @@ borgmatic_relocated_repo_access_is_ok: false
borgmatic_unknown_unencrypted_repo_access_is_ok: false
borgmatic_version: ">=1.7.11"
# Uptime Kuma monitoring configuration
# borgmatic_uptime_kuma_push_url: "https://example.uptime.kuma/api/push/abcd1234"
borgmatic_uptime_kuma_states:
- start
- finish
- fail
borgmatic_uptime_kuma_verify_tls: true
borg_venv_path: "/opt/borgmatic"
borg_user: "root"
borg_group: "root"

View File

@ -223,3 +223,21 @@ argument_specs:
type: str
required: false
description: Comment added to the SSH public key.
borgmatic_uptime_kuma_push_url:
type: str
required: false
description: |
Uptime Kuma push URL for monitoring (without query string).
Example: https://example.uptime.kuma/api/push/abcd1234
borgmatic_uptime_kuma_states:
type: list
required: false
default: ['start', 'finish', 'fail']
description: |
List of one or more monitoring states to push for: "start", "finish", and/or "fail".
Defaults to pushing for all states.
borgmatic_uptime_kuma_verify_tls:
type: bool
required: false
default: true
description: Verify the TLS certificate of the push URL host. Defaults to true.

View File

@ -197,3 +197,30 @@ check_last: {{ borgmatic_check_last }}
{{ hook }}:
{{ borgmatic_hooks[hook] | to_nice_yaml(indent=4) | indent(4, first=true) }}
{% endfor %}
{% if borgmatic_uptime_kuma_push_url is defined and borgmatic_uptime_kuma_push_url %}
# Configuration for a monitoring integration with Uptime Kuma using
# the Push monitor type.
# See more information here: https://uptime.kuma.pet
uptime_kuma:
# Uptime Kuma push URL without query string (do not include the
# question mark or anything after it).
push_url: {{ borgmatic_uptime_kuma_push_url }}
{% if borgmatic_uptime_kuma_states is defined and borgmatic_uptime_kuma_states | length > 0 %}
# List of one or more monitoring states to push for: "start",
# "finish", and/or "fail". Defaults to pushing for all
# states.
states:
{% for state in borgmatic_uptime_kuma_states %}
- {{ state }}
{% endfor %}
{% endif %}
{% if borgmatic_uptime_kuma_verify_tls is defined %}
# Verify the TLS certificate of the push URL host. Defaults to
# true.
verify_tls: {{ borgmatic_uptime_kuma_verify_tls | lower }}
{% endif %}
{% endif %}