bundles/backup-{client,server}: introduce
This commit is contained in:
parent
59c1cb8551
commit
f71653e3ce
23 changed files with 171 additions and 0 deletions
28
bundles/backup-server/items.py
Normal file
28
bundles/backup-server/items.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
assert node.has_bundle('zfs')
|
||||
|
||||
from os.path import join
|
||||
|
||||
for nodename, config in node.metadata.get('backup-server', {}).get('clients', {}).items():
|
||||
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',
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue