41 lines
1.0 KiB
YAML
41 lines
1.0 KiB
YAML
name: home-assistant-backup-sync
|
|
description: "Daily rsync of latest Home Assistant .tar backup and prune older archives"
|
|
schedule: "30 5 * * *"
|
|
|
|
ssh:
|
|
user: pi
|
|
host: 192.168.1.252
|
|
key: /dagu/ssh/dagu_id_rsa
|
|
strictHostKey: true
|
|
knownHostFile: /dagu/ssh/known_hosts
|
|
|
|
steps:
|
|
- name: find-latest-backup
|
|
executor:
|
|
type: ssh
|
|
command: >
|
|
ls -t /home/pi/.config/docker/homeassistant/backups/*.tar |
|
|
head -n 1
|
|
output: LATEST_TAR
|
|
|
|
- name: rsync-to-destination
|
|
depends: find-latest-backup
|
|
command: >
|
|
rsync -avz --progress
|
|
$(echo ${LATEST_TAR})
|
|
charish@192.168.1.254:/rinoa-storage/backups/home-assistant
|
|
|
|
- name: prune-old-backups
|
|
depends: rsync-to-destination
|
|
executor:
|
|
type: ssh
|
|
config:
|
|
user: charish
|
|
host: 192.168.1.254
|
|
key: /dagu/ssh/dagu_id_rsa
|
|
knownHostFile: /dagu/ssh/known_hosts
|
|
strictHostKey: true
|
|
command: >
|
|
cd /rinoa-storage/backups/home-assistant &&
|
|
ls -t *.tar | tail -n +8 | xargs -r rm --
|