Set up systemd service and timer for backups
This commit is contained in:
@@ -54,3 +54,39 @@ template "/root/backups/backup_all_vms.sh" do
|
||||
mode '0750'
|
||||
variables vm_domains: vm_domains
|
||||
end
|
||||
|
||||
systemd_unit "backup-libvirt-guests.service" do
|
||||
content({
|
||||
Unit: {
|
||||
Description: "Back up libvirt guest images and metadata",
|
||||
Wants: "network.target"
|
||||
},
|
||||
Service: {
|
||||
Type: "oneshot",
|
||||
EnvironmentFile: "/root/.borg_credentials.env",
|
||||
ExecStart: "/root/backups/backup_all_vms.sh",
|
||||
SyslogIdentifier: "backup-libvirt-guests",
|
||||
Restart: "no"
|
||||
}
|
||||
})
|
||||
verify false
|
||||
triggers_reload true
|
||||
action [:create]
|
||||
end
|
||||
|
||||
systemd_unit "backup-libvirt-guests.timer" do
|
||||
content({
|
||||
Unit: {
|
||||
Description: "Back up libvirt guest images and metadata",
|
||||
},
|
||||
Timer: {
|
||||
OnCalendar: node["kosmos_kvm"]["backup"]["schedule"]
|
||||
},
|
||||
Install: {
|
||||
WantedBy: "timers.target"
|
||||
}
|
||||
})
|
||||
verify false
|
||||
triggers_reload true
|
||||
action [:create, :enable, :start]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user