2020-08-21 14:21:46 +00:00
|
|
|
pkg_apt = {
|
|
|
|
'postgresql-11': {},
|
|
|
|
'postgresql-client-11': {},
|
2020-10-16 17:24:40 +00:00
|
|
|
'postgresql-server-dev-11': {},
|
2020-08-21 14:21:46 +00:00
|
|
|
}
|
|
|
|
|
2020-08-29 19:30:12 +00:00
|
|
|
if node.has_bundle('zfs'):
|
|
|
|
pkg_apt['postgresql-11']['needs'] = {
|
|
|
|
'zfs_dataset:tank/postgresql',
|
|
|
|
}
|
|
|
|
|
2020-08-21 14:21:46 +00:00
|
|
|
postgres_roles = {
|
|
|
|
'root': {
|
|
|
|
'password': repo.vault.password_for('{} postgresql root'.format(node.name)),
|
|
|
|
'superuser': True,
|
2020-08-29 19:30:12 +00:00
|
|
|
'needs': {
|
|
|
|
'svc_systemd:postgresql',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'postgresql': {
|
|
|
|
'needs': {
|
|
|
|
'pkg_apt:postgresql-11',
|
|
|
|
},
|
2020-08-21 14:21:46 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-04-04 16:28:38 +00:00
|
|
|
postgres_dbs = {}
|
2020-04-04 15:53:59 +00:00
|
|
|
|
2020-08-29 19:30:12 +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'],
|
2020-08-29 19:30:12 +00:00
|
|
|
'needs': {
|
|
|
|
'svc_systemd:postgresql',
|
|
|
|
},
|
2020-04-04 15:53:59 +00:00
|
|
|
}
|
|
|
|
|
2020-08-29 19:30:12 +00:00
|
|
|
for database, config in node.metadata.get('postgresql', {}).get('databases', {}).items():
|
2020-04-04 16:28:38 +00:00
|
|
|
postgres_dbs[database] = {
|
2020-04-04 15:53:59 +00:00
|
|
|
'owner': config['owner'],
|
2020-08-29 19:30:12 +00:00
|
|
|
'needs': {
|
|
|
|
'svc_systemd:postgresql',
|
|
|
|
},
|
2020-04-04 15:53:59 +00:00
|
|
|
}
|