run all backup tasks in a slice
This commit is contained in:
parent
d351573a3b
commit
4c54a80122
6 changed files with 61 additions and 3 deletions
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
# All types:
|
||||
# name: (required) unique identifier, used in unit and script filenames
|
||||
# type: (required) backup template to use: btrfs-subvolume, podman-postgres, postgres
|
||||
# type: (required) backup template to use: btrfs-subvolume, podman-mysql, podman-postgres, postgres, echo-test
|
||||
# user: (optional) user to run the backup as; defaults to root
|
||||
# group: (optional) group to run the backup as; defaults to backups
|
||||
# timer_delay_sec: (optional) RandomizedDelaySec for the timer; defaults to 30 minutes
|
||||
|
|
@ -11,6 +11,12 @@
|
|||
# btrfs-subvolume:
|
||||
# path: (required) path to the btrfs subvolume to back up
|
||||
#
|
||||
# podman-mysql:
|
||||
# container: (required) name of the podman container running mysql/mariadb
|
||||
# mysql_user: (required) mysql user to connect as
|
||||
# mysql_password: (required) mysql password for the user
|
||||
# database: (required) mysql database to dump
|
||||
#
|
||||
# podman-postgres:
|
||||
# container: (required) name of the podman container running postgres
|
||||
# pg_user: (required) postgres user to connect as
|
||||
|
|
@ -20,6 +26,10 @@
|
|||
# pwd: (required) working directory for podman compose
|
||||
# user: (required) postgres user to connect as
|
||||
# database: (required) postgres database to dump
|
||||
#
|
||||
# echo-test:
|
||||
# lines: (optional) number of log lines to emit; defaults to 10
|
||||
# interval_sec: (optional) seconds to sleep between lines; defaults to 1
|
||||
backups: []
|
||||
|
||||
# Restic REST server URL to publish backups to
|
||||
|
|
|
|||
5
roles/any.tools.backup-scripts/files/backup.slice
Normal file
5
roles/any.tools.backup-scripts/files/backup.slice
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[Unit]
|
||||
Description=Backup services slice
|
||||
|
||||
[Slice]
|
||||
CPUQuota=25%
|
||||
|
|
@ -35,6 +35,15 @@
|
|||
loop: "{{ backups }}"
|
||||
when: item.user is defined
|
||||
|
||||
- name: Ensure backup slice unit is present
|
||||
ansible.builtin.copy:
|
||||
src: "backup.slice"
|
||||
dest: "/etc/systemd/system/backup.slice"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Reload systemd
|
||||
|
||||
- name: Ensure systemd service unit is present for each backup
|
||||
ansible.builtin.template:
|
||||
src: "backup.service.j2"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ After=network.target
|
|||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Slice=backup.slice
|
||||
User={{ item.user | default('root') }}
|
||||
Group={{ item.group | default('backups') }}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "log line 1"
|
||||
echo "log line 2"
|
||||
echo "log line 3"
|
||||
echo "log line 4"
|
||||
echo "log line 5"
|
||||
echo "log line 6"
|
||||
Loading…
Add table
Add a link
Reference in a new issue