1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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",
},
}
}
|