This commit is contained in:
mwiegand 2021-06-23 20:15:12 +02:00
parent 479571b061
commit 941aea5642
9 changed files with 66 additions and 10 deletions

14
bundles/backup/items.py Normal file
View file

@ -0,0 +1,14 @@
from json import dumps
directories['/etc/backup'] = {}
files['/etc/backup/config.json'] = {
'content': dumps(
{
'server': node.metadata.get('backup/server'),
'paths': sorted(set(node.metadata.get('backup/paths'))),
},
indent=4,
sort_keys=True
),
}

View file

@ -0,0 +1,6 @@
defaults = {
'backup': {
'server': None,
'paths': [],
},
}

View file

@ -60,6 +60,13 @@ defaults = {
}, },
}, },
}, },
'zfs': {
'datasets': {
'tank/gitea': {
'mountpoint': '/var/lib/gitea',
},
},
},
} }

View file

@ -31,7 +31,7 @@ defaults = {
}, },
}, },
'backup': { 'backup': {
'files': [ 'paths': [
'/etc/nextcloud/config.php', '/etc/nextcloud/config.php',
], ],
}, },
@ -61,7 +61,7 @@ defaults = {
}, },
'zfs': { 'zfs': {
'datasets': { 'datasets': {
'tank/nexcloud': { 'tank/nextcloud': {
'mountpoint': '/var/lib/nextcloud', 'mountpoint': '/var/lib/nextcloud',
}, },
}, },

View file

@ -5,6 +5,11 @@ defaults = {
'postfix-pgsql': {}, 'postfix-pgsql': {},
} }
}, },
'backup': {
'paths': [
'/var/vmail',
],
},
'letsencrypt': { 'letsencrypt': {
'reload_after': { 'reload_after': {
'postfix', 'postfix',

View file

@ -1,4 +1,14 @@
defaults = { defaults = {
'apt': {
'packages': {
'postgresql': {},
},
},
'backup': {
'paths': [
'/var/lib/postgresql',
],
},
'postgresql': { 'postgresql': {
'roles': { 'roles': {
'root': { 'root': {
@ -8,11 +18,6 @@ defaults = {
}, },
'databases': {}, 'databases': {},
}, },
'apt': {
'packages': {
'postgresql': {},
},
},
} }
if node.has_bundle('zfs'): if node.has_bundle('zfs'):

View file

@ -54,3 +54,17 @@ def dataset_defaults(metadata):
}, },
}, },
} }
@metadata_reactor.provides(
'backup/paths'
)
def backup(metadata):
return {
'backup': {
'paths': [
options['mountpoint'] for options in metadata.get('zfs/datasets').values()
if options.get('backup', True)
],
},
}

View file

@ -1,5 +1,11 @@
{ {
'bundles': [
'backup',
],
'metadata': { 'metadata': {
'backup': {
'server': 'backups.sublimity.de',
},
'dns': {}, 'dns': {},
} }
} }

View file

@ -9,11 +9,10 @@
'dnsserver', 'dnsserver',
], ],
'bundles': [ 'bundles': [
'gcloud',
'wireguard', 'wireguard',
'nextcloud', #TEMP
'influxdb2', #TEMP
'zfs', 'zfs',
'nextcloud',
'influxdb2',
], ],
'metadata': { 'metadata': {
'bind': { 'bind': {