Skip to content
Snippets Groups Projects
Verified Commit baa9bd7b authored by nd's avatar nd
Browse files

added systemd services

parent 420be44f
No related branches found
No related tags found
No related merge requests found
- name: reload systemd
systemd:
daemon_reload: True
......@@ -47,13 +47,28 @@
- backup-all-vms
- backup-full
- backup-cronjob
- backup-check
template:
src: "{{ item }}.j2"
dest: "/usr/local/bin/{{ item }}"
owner: root
group: root
mode: 0700
mode: 0755
validate: /bin/bash -n %s
- name: copy systemd services
notify:
- reload systemd
loop:
- backup-check
- backup-retention
- backup-run
template:
src: "{{ item }}.service.j2"
dest: "/etc/systemd/system/{{ item }}.service"
owner: root
group: root
mode: 0644
# validate: /usr/bin/systemd-analyze verify %s
- name: create data folder
file:
path: /var/backup-client/
......
#!/bin/bash
set -euo pipefail
{% if backup_backend == 'restic' %}
# restic backend
source /etc/backup-client/restic.env
restic check --read-data
{% endif %}
{% if not backup_backend %}
echo "Noop, backup is handled external"
{% endif %}
[Unit]
Description=Check backup consistency
OnFailure=status-email-root@%n.service
[Service]
Nice=19
IOSchedulingClass=idle
Type=simple
ExecStart=/usr/local/bin/backup-check
......@@ -7,7 +7,3 @@ set -euo pipefail
{% if backups.mode in ['hypervisor-restic'] %}
backup-all-vms
{% endif %}
{% if backup_executor %}
backup-retention
{% endif %}
......@@ -7,6 +7,7 @@ source /etc/backup-client/retention.env
# restic backend
source /etc/backup-client/restic.env
restic forget \
--cleanup-cache \
--verbose \
--prune \
--group-by "host,paths,tags" \
......@@ -17,3 +18,6 @@ restic forget \
--keep-yearly ${BACKUP_RETENTION_YEARS}
{% endif %}
{% if not backup_backend %}
echo "Noop, backup is handled external"
{% endif %}
[Unit]
Description=Delete no longer needed backups
OnFailure=status-email-root@%n.service
[Service]
Nice=19
IOSchedulingClass=idle
Type=simple
ExecStart=/usr/local/bin/backup-retention
[Unit]
Description=Backup system
OnFailure=status-email-root@%n.service
[Service]
Nice=19
IOSchedulingClass=idle
Type=simple
ExecStart=/usr/local/bin/backup-full
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment