2021-04-02 16:57:13 +00:00
|
|
|
repo.libs.tools.require_bundle(node, 'zfs')
|
2020-11-13 11:36:52 +00:00
|
|
|
|
|
|
|
from os.path import join
|
|
|
|
|
2021-02-18 17:12:25 +00:00
|
|
|
for nodename, config in node.metadata.get('backup-server/clients', {}).items():
|
2020-11-13 11:36:52 +00:00
|
|
|
with open(join(repo.path, 'data', 'backup', 'keys', f'{nodename}.pub'), 'r') as f:
|
|
|
|
pubkey = f.read().strip()
|
|
|
|
|
|
|
|
users[config['user']] = {
|
|
|
|
'home': f'/srv/backups/{nodename}',
|
|
|
|
}
|
|
|
|
|
|
|
|
files[f'/srv/backups/{nodename}/.ssh/authorized_keys'] = {
|
|
|
|
'content': pubkey,
|
|
|
|
'owner': config['user'],
|
|
|
|
'mode': '0400',
|
|
|
|
'needs': {
|
|
|
|
'bundle:zfs',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
directories[f'/srv/backups/{nodename}/backups'] = {
|
|
|
|
'owner': config['user'],
|
|
|
|
'mode': '0700',
|
|
|
|
'needs': {
|
|
|
|
'bundle:zfs',
|
|
|
|
},
|
|
|
|
}
|