commit
b76ca612cb
5 changed files with 16 additions and 7 deletions
|
@ -7,8 +7,6 @@ class postgresql::params inherits postgresql::globals {
|
|||
$ip_mask_allow_all_users = '127.0.0.1/32'
|
||||
$ipv4acls = []
|
||||
$ipv6acls = []
|
||||
$user = pick($user, 'postgres')
|
||||
$group = pick($group, 'postgres')
|
||||
$encoding = $encoding
|
||||
$locale = $locale
|
||||
$service_provider = $service_provider
|
||||
|
@ -18,6 +16,8 @@ class postgresql::params inherits postgresql::globals {
|
|||
# Amazon Linux's OS Family is 'Linux', operating system 'Amazon'.
|
||||
case $::osfamily {
|
||||
'RedHat', 'Linux': {
|
||||
$user = pick($user, 'postgres')
|
||||
$group = pick($group, 'postgres')
|
||||
$needs_initdb = pick($needs_initdb, true)
|
||||
$firewall_supported = pick($firewall_supported, true)
|
||||
|
||||
|
@ -64,6 +64,8 @@ class postgresql::params inherits postgresql::globals {
|
|||
# so they can set it themself
|
||||
$firewall_supported = pick($firewall_supported, true)
|
||||
$needs_initdb = pick($needs_initdb, true)
|
||||
$user = pick($user, 'postgres')
|
||||
$group = pick($group, 'postgres')
|
||||
|
||||
# Archlinux doesn't have a client-package but has a libs package which
|
||||
# pulls in postgresql server
|
||||
|
@ -87,6 +89,8 @@ class postgresql::params inherits postgresql::globals {
|
|||
}
|
||||
|
||||
'Debian': {
|
||||
$user = pick($user, 'postgres')
|
||||
$group = pick($group, 'postgres')
|
||||
|
||||
if $manage_package_repo == true {
|
||||
$needs_initdb = pick($needs_initdb, true)
|
||||
|
@ -121,6 +125,8 @@ class postgresql::params inherits postgresql::globals {
|
|||
}
|
||||
|
||||
'FreeBSD': {
|
||||
$user = pick($user, 'pgsql')
|
||||
$group = pick($group, 'pgsql')
|
||||
|
||||
$client_package_name = pick($client_package_name, "databases/postgresql${version}-client")
|
||||
$server_package_name = pick($server_package_name, "databases/postgresql${version}-server")
|
||||
|
@ -133,7 +139,7 @@ class postgresql::params inherits postgresql::globals {
|
|||
$service_name = pick($service_name, 'postgresql')
|
||||
$bindir = pick($bindir, '/usr/local/bin')
|
||||
$datadir = pick($datadir, '/usr/local/pgsql/data')
|
||||
$confdir = pick($confdir, '/usr/local/share/postgresql')
|
||||
$confdir = pick($confdir, $datadir)
|
||||
$service_status = pick($service_status, "/usr/local/etc/rc.d/${service_name} status")
|
||||
$psql_path = pick($psql_path, "${bindir}/psql")
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ define postgresql::server::database(
|
|||
$group = $postgresql::server::group
|
||||
$psql_path = $postgresql::server::psql_path
|
||||
$version = $postgresql::server::version
|
||||
$default_db = $postgresql::server::default_database
|
||||
|
||||
# Set the defaults for the postgresql_psql resource
|
||||
Postgresql_psql {
|
||||
|
@ -49,6 +50,7 @@ define postgresql::server::database(
|
|||
postgresql_psql { "Check for existence of db '${dbname}'":
|
||||
command => 'SELECT 1',
|
||||
unless => "SELECT datname FROM pg_database WHERE datname='${dbname}'",
|
||||
db => $default_db,
|
||||
require => Class['postgresql::server::service']
|
||||
}~>
|
||||
exec { $createdb_command :
|
||||
|
@ -60,13 +62,14 @@ define postgresql::server::database(
|
|||
# This will prevent users from connecting to the database unless they've been
|
||||
# granted privileges.
|
||||
postgresql_psql {"REVOKE ${public_revoke_privilege} ON DATABASE \"${dbname}\" FROM public":
|
||||
db => $user,
|
||||
db => $default_db,
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
Exec [ $createdb_command ]->
|
||||
postgresql_psql {"UPDATE pg_database SET datistemplate = ${istemplate} WHERE datname = '${dbname}'":
|
||||
unless => "SELECT datname FROM pg_database WHERE datname = '${dbname}' AND datistemplate = ${istemplate}",
|
||||
db => $default_db,
|
||||
}
|
||||
|
||||
# Build up dependencies on tablespace
|
||||
|
|
|
@ -5,7 +5,7 @@ define postgresql::server::grant (
|
|||
$privilege = undef,
|
||||
$object_type = 'database',
|
||||
$object_name = $db,
|
||||
$psql_db = $postgresql::server::user,
|
||||
$psql_db = $postgresql::server::default_database,
|
||||
$psql_user = $postgresql::server::user
|
||||
) {
|
||||
$group = $postgresql::server::group
|
||||
|
|
|
@ -3,7 +3,7 @@ define postgresql::server::role(
|
|||
$password_hash = false,
|
||||
$createdb = false,
|
||||
$createrole = false,
|
||||
$db = $postgresql::server::user,
|
||||
$db = $postgresql::server::default_database,
|
||||
$login = true,
|
||||
$superuser = false,
|
||||
$replication = false,
|
||||
|
|
|
@ -55,7 +55,7 @@ define postgresql::validate_db_connection(
|
|||
environment => $env,
|
||||
logoutput => 'on_failure',
|
||||
user => $run_as,
|
||||
path => '/bin',
|
||||
path => '/bin:/usr/bin:/usr/local/bin',
|
||||
timeout => $timeout,
|
||||
require => Package['postgresql-client'],
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue