Manage own borgmatic systemd service and timer
Ship borgmatic.service and borgmatic.timer from the backup role instead of relying on the package-provided units. The units are deployed to /etc/systemd/system (overriding the package units), with a configurable schedule via role defaults. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# Managed by Ansible — do not edit by hand.
|
||||
[Unit]
|
||||
Description=borgmatic backup
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
# Don't run on battery power.
|
||||
ConditionACPower=true
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
# Lower priority so backups don't starve foreground work.
|
||||
Nice=19
|
||||
CPUSchedulingPolicy=batch
|
||||
IOSchedulingClass=best-effort
|
||||
IOSchedulingPriority=7
|
||||
IOWeight=100
|
||||
Restart=no
|
||||
# Prevent rate limiting of borgmatic log events.
|
||||
LogRateLimitIntervalSec=0
|
||||
# Delay start by a random amount handled in the timer; keep the service simple.
|
||||
ExecStart=systemd-inhibit --who="borgmatic" --what="sleep:shutdown" --why="Prevent interrupting scheduled backup" /usr/bin/borgmatic {{ borgmatic_verbosity_args }}
|
||||
@@ -0,0 +1,11 @@
|
||||
# Managed by Ansible — do not edit by hand.
|
||||
[Unit]
|
||||
Description=Run borgmatic backup
|
||||
|
||||
[Timer]
|
||||
OnCalendar={{ borgmatic_oncalendar }}
|
||||
RandomizedDelaySec={{ borgmatic_randomized_delay_sec }}
|
||||
Persistent={{ borgmatic_persistent | bool | lower }}
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user