47 lines
1 KiB
Python
47 lines
1 KiB
Python
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 = {}
|
|
|
|
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.get('postgresql', {}).get('databases', {}).items():
|
|
postgres_dbs[database] = {
|
|
'owner': config['owner'],
|
|
'needs': {
|
|
'postgres_role:',
|
|
'svc_systemd:postgresql',
|
|
},
|
|
}
|