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': {
'files': [
'paths': [
'/etc/nextcloud/config.php',
],
},
@ -61,7 +61,7 @@ defaults = {
},
'zfs': {
'datasets': {
'tank/nexcloud': {
'tank/nextcloud': {
'mountpoint': '/var/lib/nextcloud',
},
},

View file

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

View file

@ -1,4 +1,14 @@
defaults = {
'apt': {
'packages': {
'postgresql': {},
},
},
'backup': {
'paths': [
'/var/lib/postgresql',
],
},
'postgresql': {
'roles': {
'root': {
@ -8,11 +18,6 @@ defaults = {
},
'databases': {},
},
'apt': {
'packages': {
'postgresql': {},
},
},
}
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': {
'backup': {
'server': 'backups.sublimity.de',
},
'dns': {},
}
}

View file

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