2020-11-13 11:36:52 +00:00
|
|
|
from os.path import join
|
|
|
|
|
|
|
|
if node.metadata['backups'].get('exclude_from_backups', False):
|
|
|
|
files = {
|
|
|
|
'/etc/backup.priv': {
|
|
|
|
'delete': True,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
else:
|
2020-11-14 11:49:57 +00:00
|
|
|
if ':' in node.metadata['backup-client']['server']:
|
|
|
|
server, port = node.metadata['backup-client']['server'].split(':')
|
|
|
|
else:
|
|
|
|
server = node.metadata['backup-client']['server']
|
|
|
|
port = 22
|
|
|
|
|
2020-11-13 11:36:52 +00:00
|
|
|
files = {
|
|
|
|
'/usr/local/bin/generate-backup': {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'context': {
|
|
|
|
'username': node.metadata['backup-client']['user-name'],
|
2020-11-14 11:49:57 +00:00
|
|
|
'server': server,
|
|
|
|
'port': port,
|
2020-11-13 11:36:52 +00:00
|
|
|
'paths': node.metadata.get('backups', {}).get('paths', {}),
|
|
|
|
},
|
|
|
|
'mode': '0700',
|
|
|
|
},
|
2021-01-01 12:59:42 +00:00
|
|
|
'/usr/local/share/icinga/plugins/check_backup_last_run': {
|
|
|
|
'mode': '0755',
|
|
|
|
},
|
2020-11-13 11:36:52 +00:00
|
|
|
'/etc/backup.priv': {
|
|
|
|
'content': repo.vault.decrypt_file(join('backup', 'keys', f'{node.name}.key.vault')),
|
|
|
|
'mode': '0400',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|