bundlewrap/bundles/postgresql/items.py

48 lines
1 KiB
Python
Raw Normal View History

pkg_apt = {
'postgresql-11': {},
'postgresql-client-11': {},
'postgresql-server-dev-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 = {}
2020-04-04 15:53:59 +00:00
for user, config in node.metadata.get('postgresql', {}).get('users', {}).items():
2020-04-04 15:53:59 +00:00
postgres_roles[user] = {
'password': config['password'],
'needs': {
'svc_systemd:postgresql',
},
2020-04-04 15:53:59 +00:00
}
for database, config in node.metadata.get('postgresql', {}).get('databases', {}).items():
postgres_dbs[database] = {
2020-04-04 15:53:59 +00:00
'owner': config['owner'],
'needs': {
'postgres_role:',
'svc_systemd:postgresql',
},
2020-04-04 15:53:59 +00:00
}