Fix debian 7 regexp, rename to default_version and some cleanup
Signed-off-by: Ken Barber <ken@bob.sh>
This commit is contained in:
parent
7d84b6ac0e
commit
a0a2a00a49
4 changed files with 39 additions and 33 deletions
|
@ -41,7 +41,7 @@ class postgresql::globals (
|
||||||
) {
|
) {
|
||||||
# We are determining this here, because it is needed by the package repo
|
# We are determining this here, because it is needed by the package repo
|
||||||
# class.
|
# class.
|
||||||
$postgres_default_version = $::osfamily ? {
|
$default_version = $::osfamily ? {
|
||||||
/^(RedHat|Linux)/ => $::operatingsystemrelease ? {
|
/^(RedHat|Linux)/ => $::operatingsystemrelease ? {
|
||||||
/^6\./ => '8.4',
|
/^6\./ => '8.4',
|
||||||
/^5\./ => '8.1',
|
/^5\./ => '8.1',
|
||||||
|
@ -50,7 +50,7 @@ class postgresql::globals (
|
||||||
'Debian' => $::operatingsystem ? {
|
'Debian' => $::operatingsystem ? {
|
||||||
'Debian' => $::operatingsystemrelease ? {
|
'Debian' => $::operatingsystemrelease ? {
|
||||||
/^6\./ => '8.4',
|
/^6\./ => '8.4',
|
||||||
/^(wheezy|7\.)$/ => '9.1',
|
/^(wheezy|7\.)/ => '9.1',
|
||||||
default => undef,
|
default => undef,
|
||||||
},
|
},
|
||||||
'Ubuntu' => $::operatingsystemrelease ? {
|
'Ubuntu' => $::operatingsystemrelease ? {
|
||||||
|
@ -62,7 +62,7 @@ class postgresql::globals (
|
||||||
},
|
},
|
||||||
default => undef,
|
default => undef,
|
||||||
}
|
}
|
||||||
$globals_version = pick($version, $postgres_default_version, 'unknown')
|
$globals_version = pick($version, $default_version, 'unknown')
|
||||||
if($globals_version == 'unknown') {
|
if($globals_version == 'unknown') {
|
||||||
fail("No preferred version defined or automatically detected.")
|
fail("No preferred version defined or automatically detected.")
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,33 +13,33 @@ class postgresql::params inherits postgresql::globals {
|
||||||
# Amazon Linux's OS Family is 'Linux', operating system 'Amazon'.
|
# Amazon Linux's OS Family is 'Linux', operating system 'Amazon'.
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'RedHat', 'Linux': {
|
'RedHat', 'Linux': {
|
||||||
$needs_initdb = pick($needs_initdb, true)
|
$needs_initdb = pick($needs_initdb, true)
|
||||||
$firewall_supported = pick($firewall_supported, true)
|
$firewall_supported = pick($firewall_supported, true)
|
||||||
|
|
||||||
if $version == $postgres_default_version {
|
if $version == $default_version {
|
||||||
$client_package_name = pick($client_package_name, 'postgresql')
|
$client_package_name = pick($client_package_name, 'postgresql')
|
||||||
$server_package_name = pick($server_package_name, 'postgresql-server')
|
$server_package_name = pick($server_package_name, 'postgresql-server')
|
||||||
$contrib_package_name = pick($contrib_package_name,'postgresql-contrib')
|
$contrib_package_name = pick($contrib_package_name,'postgresql-contrib')
|
||||||
$devel_package_name = pick($devel_package_name, 'postgresql-devel')
|
$devel_package_name = pick($devel_package_name, 'postgresql-devel')
|
||||||
$java_package_name = pick($java_package_name, 'postgresql-jdbc')
|
$java_package_name = pick($java_package_name, 'postgresql-jdbc')
|
||||||
$plperl_package_name = pick($plperl_package_name, 'postgresql-plperl')
|
$plperl_package_name = pick($plperl_package_name, 'postgresql-plperl')
|
||||||
$service_name = pick($service_name, 'postgresql')
|
$service_name = pick($service_name, 'postgresql')
|
||||||
$bindir = pick($bindir, '/usr/bin')
|
$bindir = pick($bindir, '/usr/bin')
|
||||||
$datadir = pick($datadir, '/var/lib/pgsql/data')
|
$datadir = pick($datadir, '/var/lib/pgsql/data')
|
||||||
$confdir = pick($confdir, $datadir)
|
$confdir = pick($confdir, $datadir)
|
||||||
} else {
|
} else {
|
||||||
$version_parts = split($version, '[.]')
|
$version_parts = split($version, '[.]')
|
||||||
$package_version = "${version_parts[0]}${version_parts[1]}"
|
$package_version = "${version_parts[0]}${version_parts[1]}"
|
||||||
$client_package_name = pick($client_package_name, "postgresql${package_version}")
|
$client_package_name = pick($client_package_name, "postgresql${package_version}")
|
||||||
$server_package_name = pick($server_package_name, "postgresql${package_version}-server")
|
$server_package_name = pick($server_package_name, "postgresql${package_version}-server")
|
||||||
$contrib_package_name = pick($contrib_package_name,"postgresql${package_version}-contrib")
|
$contrib_package_name = pick($contrib_package_name,"postgresql${package_version}-contrib")
|
||||||
$devel_package_name = pick($devel_package_name, "postgresql${package_version}-devel")
|
$devel_package_name = pick($devel_package_name, "postgresql${package_version}-devel")
|
||||||
$java_package_name = pick($java_package_name, "postgresql${package_version}-jdbc")
|
$java_package_name = pick($java_package_name, "postgresql${package_version}-jdbc")
|
||||||
$plperl_package_name = pick($plperl_package_name, "postgresql${package_version}-plperl")
|
$plperl_package_name = pick($plperl_package_name, "postgresql${package_version}-plperl")
|
||||||
$service_name = pick($service_name, "postgresql-${version}")
|
$service_name = pick($service_name, "postgresql-${version}")
|
||||||
$bindir = pick($bindir, "/usr/pgsql-${version}/bin")
|
$bindir = pick($bindir, "/usr/pgsql-${version}/bin")
|
||||||
$datadir = pick($datadir, "/var/lib/pgsql/${version}/data")
|
$datadir = pick($datadir, "/var/lib/pgsql/${version}/data")
|
||||||
$confdir = pick($confdir, $datadir)
|
$confdir = pick($confdir, $datadir)
|
||||||
}
|
}
|
||||||
|
|
||||||
$service_status = $service_status
|
$service_status = $service_status
|
||||||
|
|
|
@ -18,14 +18,14 @@ define postgresql::server::db (
|
||||||
|
|
||||||
if ! defined(Postgresql::Server::Role[$user]) {
|
if ! defined(Postgresql::Server::Role[$user]) {
|
||||||
postgresql::server::role { $user:
|
postgresql::server::role { $user:
|
||||||
password_hash => $password,
|
password_hash => $password,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
postgresql::server::database_grant { "GRANT ${user} - ${grant} - ${name}":
|
postgresql::server::database_grant { "GRANT ${user} - ${grant} - ${name}":
|
||||||
privilege => $grant,
|
privilege => $grant,
|
||||||
db => $name,
|
db => $name,
|
||||||
role => $user,
|
role => $user,
|
||||||
}
|
}
|
||||||
|
|
||||||
if($tablespace != undef and defined(Postgresql::Server::Tablespace[$tablespace])) {
|
if($tablespace != undef and defined(Postgresql::Server::Tablespace[$tablespace])) {
|
||||||
|
|
|
@ -3,8 +3,14 @@ class postgresql::server::install {
|
||||||
$package_ensure = $postgresql::server::package_ensure
|
$package_ensure = $postgresql::server::package_ensure
|
||||||
$package_name = $postgresql::server::package_name
|
$package_name = $postgresql::server::package_name
|
||||||
|
|
||||||
|
$_package_ensure = $package_ensure ? {
|
||||||
|
true => 'present',
|
||||||
|
false => 'purged',
|
||||||
|
default => $package_ensure,
|
||||||
|
}
|
||||||
|
|
||||||
package { 'postgresql-server':
|
package { 'postgresql-server':
|
||||||
ensure => $package_ensure,
|
ensure => $_package_ensure,
|
||||||
name => $package_name,
|
name => $package_name,
|
||||||
|
|
||||||
# This is searched for to create relationships with the package repos, be
|
# This is searched for to create relationships with the package repos, be
|
||||||
|
|
Loading…
Reference in a new issue