From 38be6c13f76e893cf47636257071b440dec0c5b2 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Sun, 7 Sep 2025 17:32:13 +0200 Subject: initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- bundles/restic-backup/items.py | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 bundles/restic-backup/items.py (limited to 'bundles/restic-backup/items.py') diff --git a/bundles/restic-backup/items.py b/bundles/restic-backup/items.py new file mode 100644 index 0000000..9ffc565 --- /dev/null +++ b/bundles/restic-backup/items.py @@ -0,0 +1,62 @@ +if node.os != "alpine": + raise BundleError(f"{node.name}: OS {node.os} is not supported.") + +files = { + "/usr/bin/resticw": { + "source": "resticw", + "content_type": "text", + "mode": "0755", + }, + "/usr/bin/resticbackup": { + "source": "resticbackup", + "content_type": "text", + "mode": "0755", + }, + "/usr/bin/resticrestore": { + "source": "resticrestore", + "content_type": "text", + "mode": "0755", + }, + "/etc/restic/restic.conf": { + "source": "restic.conf", + "content_type": "mako", + "mode": "0600", + }, + "/etc/restic/includes": { + "source": "includes", + "content_type": "mako", + "context": { + "paths": sorted(node.metadata.get("backup/includes", {})), + }, + }, + "/etc/restic/excludes": { + "source": "includes", + "content_type": "mako", + "context": { + "paths": sorted(node.metadata.get("backup/excludes", {})), + }, + }, + "/etc/periodic/weekly/restic-backup": { + "source": "cron_job", + "content_type": "mako", + "mode": "0755", + "needs": { + "bundle:tgnotify", + } + }, +} + +actions = { + f"initialize_restic_repository": { + "command": "resticw init", + "unless": "resticw cat config", + "needs": { + "file:/usr/bin/resticw", + "file:/etc/restic/restic.conf", + }, + "triggered": True, + "triggered_by": { + "file:/etc/restic/restic.conf", + }, + } +} -- cgit 1.4.1