2012-06-08 22:37:21 +02:00
# Class : postgresql: : params
#
# The postgresql configuration settings.
#
# Parameters:
#
# Actions:
#
# Requires :
#
# Sample Usage:
#
2012-11-09 21:12:24 +01:00
class postgresql: : params {
2012-06-09 18:23:11 +02:00
$ user = 'postgres'
$ group = 'postgres'
$ ip_mask_deny_postgres_user = '0.0.0.0/0'
$ ip_mask_allow_all_users = '127.0.0.1/32'
$ listen_addresses = 'localhost'
2012-10-22 07:27:35 +02:00
$ ipv4acls = [ ]
$ ipv6acls = [ ]
2012-06-08 23:00:24 +02:00
# TODO: figure out a way to make this not platform - specific
2012-06-09 18:23:11 +02:00
$ manage_redhat_firewall = false
2012-06-08 23:00:24 +02:00
2012-09-14 22:09:31 +02:00
# This is a bit hacky, but if the puppet nodes don' t have pluginsync enabled,
# they will fail with a not - so- helpful error message . Here we are explicitly
# verifying that the custom fact exists ( which implies that pluginsync is
# enabled and succeeded) . If not , we fail with a hint that tells the user
# that pluginsync might not be enabled. Ideally this would be handled directly
# in puppet.
if ( $ : : postgres_default_version = = undef) {
fail "No value for postgres_default_version facter fact; it's possible that you don't have pluginsync enabled."
}
2012-12-04 05:42:20 +01:00
if defined( Class [ Postgresql: : Package_source_info] ) {
$ version = $ postgresql: : package_source_info: : version
} else {
$ version = $ : : postgres_default_version
}
case $ : : operatingsystem {
default : {
$ service_provider = undef
}
}
2012-06-08 22:37:21 +02:00
case $ : : osfamily {
'RedHat' : {
2012-06-08 23:00:24 +02:00
$ needs_initdb = true
$f irewall_supported = true
2012-12-04 05:42:20 +01:00
$ persist_firewall_command = '/sbin/iptables-save > /etc/sysconfig/iptables'
if $ version = = $ : : postgres_default_version {
$c lient_package_name = 'postgresql'
$ server_package_name = 'postgresql-server'
$de vel_package_name = 'postgresql-devel'
$ service_name = 'postgresql'
$b indir = '/usr/bin'
$da tadir = '/var/lib/pgsql/data'
$c onfdir = $da tadir
} else {
$ version_parts = split( $ version, '[.]' )
$ package_version = "${version_parts[0]}${version_parts[1]}"
$c lient_package_name = "postgresql${package_version}"
$ server_package_name = "postgresql${package_version}-server"
$de vel_package_name = "postgresql${package_version}-devel"
$ service_name = "postgresql-${version}"
$b indir = "/usr/pgsql-${version}/bin"
$da tadir = "/var/lib/pgsql/${version}/data"
$c onfdir = $da tadir
}
$ service_status = undef
2012-06-08 22:37:21 +02:00
}
2012-12-04 05:42:20 +01:00
2012-06-08 22:37:21 +02:00
'Debian' : {
2012-06-08 23:00:24 +02:00
$ needs_initdb = false
$f irewall_supported = false
# TODO: not exactly sure yet what the right thing to do for Debian/ Ubuntu is .
# $ persist_firewall_command = '/sbin/iptables-save > /etc/iptables/rules.v4'
2012-12-04 05:42:20 +01:00
case $ : : operatingsystem {
'Debian' : {
$ service_name = 'postgresql'
}
'Ubuntu' : {
case $ : : lsbmajdistrelease {
# thanks, ubuntu
'10' : { $service_name = "postgresql-${::postgres_default_version} " }
default : { $service_name = 'postgresql' }
}
}
}
$c lient_package_name = 'postgresql-client'
$ server_package_name = 'postgresql'
$de vel_package_name = 'libpq-dev'
$b indir = "/usr/lib/postgresql/${::postgres_default_version}/bin"
$da tadir = "/var/lib/postgresql/${::postgres_default_version}/main"
$c onfdir = "/etc/postgresql/${::postgres_default_version}/main"
$ service_status = "/etc/init.d/${service_name} status | /bin/egrep -q 'Running clusters: .+'"
2012-06-08 22:37:21 +02:00
}
default : {
fail( "Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports osfamily RedHat and Debian" )
}
}
2012-12-04 05:42:20 +01:00
$ initdb_path = "${bindir}/initdb"
$c reatedb_path = "${bindir}/createdb"
$ psql_path = "${bindir}/psql"
$ pg_hba_conf_path = "${confdir}/pg_hba.conf"
$ postgresql_conf_path = "${confdir}/postgresql.conf"
2012-06-08 22:37:21 +02:00
}