bundles/postgresql: use zfs if possible
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-08-29 21:30:12 +02:00
parent 68a4359a8c
commit 049b77e702
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 34 additions and 2 deletions

View file

@ -3,21 +3,43 @@ pkg_apt = {
'postgresql-client-11': {},
}
if node.has_bundle('zfs'):
pkg_apt['postgresql-11']['needs'] = {
'zfs_dataset:tank/postgresql',
}
postgres_roles = {
'root': {
'password': repo.vault.password_for('{} postgresql root'.format(node.name)),
'superuser': True,
'needs': {
'svc_systemd:postgresql',
},
},
}
svc_systemd = {
'postgresql': {
'needs': {
'pkg_apt:postgresql-11',
},
},
}
postgres_dbs = {}
for user, config in node.metadata['postgresql']['users'].items():
for user, config in node.metadata.get('postgresql', {}).get('users', {}).items():
postgres_roles[user] = {
'password': config['password'],
'needs': {
'svc_systemd:postgresql',
},
}
for database, config in node.metadata['postgresql']['databases'].items():
for database, config in node.metadata.get('postgresql', {}).get('databases', {}).items():
postgres_dbs[database] = {
'owner': config['owner'],
'needs': {
'svc_systemd:postgresql',
},
}

View file

@ -0,0 +1,10 @@
defaults = {}
if node.has_bundle('zfs'):
defaults['zfs'] = {
'datasets': {
'tank/postgresql': {
'mountpoint': '/var/lib/postgresql',
},
},
}