backup openhab
This commit is contained in:
parent
b5489cd22f
commit
72561bdb52
4 changed files with 22 additions and 6 deletions
|
@ -40,9 +40,16 @@ def zfs(metadata):
|
|||
'readonly': 'off',
|
||||
'backup': False,
|
||||
}
|
||||
|
||||
# for zfs send/recv
|
||||
if other_node.has_bundle('zfs'):
|
||||
# base datasets for each tank
|
||||
for pool in other_node.metadata.get('zfs/pools'):
|
||||
datasets[f"tank/{other_node.metadata.get('id')}/{pool}"] = {
|
||||
'mountpoint': None,
|
||||
'readonly': 'on',
|
||||
'backup': False,
|
||||
}
|
||||
# actual datasets
|
||||
for path in other_node.metadata.get('backup/paths'):
|
||||
for dataset, config in other_node.metadata.get('zfs/datasets').items():
|
||||
if path == config.get('mountpoint'):
|
||||
|
|
|
@ -45,7 +45,7 @@ fi
|
|||
if [[ "$?" == "0" ]]
|
||||
then
|
||||
zfs bookmark "$source_dataset@$new_bookmark" "$source_dataset#$new_bookmark"
|
||||
zfs destroy "$source_dataset@$new_bookmark"
|
||||
#zfs destroy "$source_dataset@$new_bookmark" # keep snapshots?
|
||||
echo "SUCCESS"
|
||||
else
|
||||
zfs destroy "$source_dataset@$new_bookmark"
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
defaults = {
|
||||
'apt': {
|
||||
'packages': {
|
||||
'jq': {},
|
||||
'rsync': {},
|
||||
'jq': {
|
||||
'needed_by': {
|
||||
'svc_systemd:backup.timer',
|
||||
},
|
||||
},
|
||||
'rsync': {
|
||||
'needed_by': {
|
||||
'svc_systemd:backup.timer',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'backup': {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
'hostname': '10.0.0.17',
|
||||
'groups': [
|
||||
'raspberry-pi',
|
||||
'backup',
|
||||
'debian-11',
|
||||
'monitored',
|
||||
'raspberry-pi',
|
||||
'webserver',
|
||||
],
|
||||
'bundles': [
|
||||
|
@ -39,7 +40,7 @@
|
|||
'pools': {
|
||||
'tank': {
|
||||
'devices': [
|
||||
'/dev/sda',
|
||||
'/dev/mmcblk1p3',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue