diff options
| author | Robert Günzler <r@gnzler.io> | 2025-09-07 17:32:13 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2025-09-07 17:42:42 +0200 |
| commit | 38be6c13f76e893cf47636257071b440dec0c5b2 (patch) | |
| tree | f7ded3235a7e3362cbd1ed3d91523968fe0faf90 /bundles/restic-backup/items.py | |
initial commit
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bundles/restic-backup/items.py')
| -rw-r--r-- | bundles/restic-backup/items.py | 62 |
1 files changed, 62 insertions, 0 deletions
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", + }, + } +} |