bundles/postgresql: use zfs if possible
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
68a4359a8c
commit
049b77e702
2 changed files with 34 additions and 2 deletions
|
@ -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',
|
||||
},
|
||||
}
|
||||
|
|
10
bundles/postgresql/metadata.py
Normal file
10
bundles/postgresql/metadata.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
defaults = {}
|
||||
|
||||
if node.has_bundle('zfs'):
|
||||
defaults['zfs'] = {
|
||||
'datasets': {
|
||||
'tank/postgresql': {
|
||||
'mountpoint': '/var/lib/postgresql',
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue