From b7085c7e5bd4ef37229d9fd6602fc3cacf06ed16 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Thu, 20 Oct 2022 22:35:49 -0500 Subject: [PATCH] Implement dynamic backups for ostree systems, backing up system configuration in its entirety --- roles/backup/templates/s3backup.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/roles/backup/templates/s3backup.sh b/roles/backup/templates/s3backup.sh index 37fed9e..8d1e6b4 100644 --- a/roles/backup/templates/s3backup.sh +++ b/roles/backup/templates/s3backup.sh @@ -33,7 +33,18 @@ declare -a DIRS {% for item in backup_s3backup_list + backup_s3backup_list_extra %} DIRS+=("{{ item }}") {% endfor %} -# End directories +# End directory manual configuration + +# If we have ostree, add diff'd configs to the list, too +if command -v ostree > /dev/null 2>&1; then + for file in $( + ostree admin config-diff 2>/dev/null | \ + grep -e '^[A|M]' | \ + awk '{print $2}' + ); do + DIRS+=("/etc/$file") + done +fi # Tar up all items in the backup list, recursively, and pipe them straight # up to S3