module-postgresql/manifests/server.pp
Chris Price ba802475ff Improve configuration for initial postgres install
This commit adds some configuration management for
postgres, to allow users to get a more complete
setup from their initial install.  Prior to this
commit, we were basically only ensuring that the
package was installed and the service was running.

Now, we support limited configuration for the
pg_hba.conf file to enable md5 authentication for
remote hosts, and for the postgresql.conf file
to specify the listener addresses where TCP
connections should be accepted.  Without these
two changes the initial postgres configuration
doesn't allow *any* connections from outside of the
local host.

This commit also adds an option for opening up the
postgres port in the firewall on redhat-based systems,
and an option to allow setting the password for the
'postgres' database user.

As of this commit, this module now has dependencies
on puppetlabs-stdlib (version > 2.3.4, which includes
the new 'match' parameter for the 'file_line' resource
type), and on puppetlabs-firewall.
2012-06-08 14:00:24 -07:00

51 lines
1.2 KiB
Puppet

# Class: postgresql::server
#
# manages the installation of the postgresql server. manages the package and service
#
# Parameters:
# [*package_name*] - name of package
# [*service_name*] - name of service
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
class postgresql::server (
$package_name = $postgresql::params::server_package_name,
$package_ensure = 'present',
$service_name = $postgresql::params::service_name,
$service_provider = $postgresql::params::service_provider,
$config_hash = {}
) inherits postgresql::params {
package { 'postgresql-server':
name => $package_name,
ensure => $package_ensure,
}
$config_class = {}
$config_class['postgresql::config'] = $config_hash
create_resources( 'class', $config_class )
Package['postgresql-server'] -> Class['postgresql::config']
if ($needs_initdb) {
include postgresql::initdb
Class['postgresql::initdb'] -> Class['postgresql::config']
Class['postgresql::initdb'] -> Service['postgresqld']
}
service { 'postgresqld':
name => $service_name,
ensure => running,
enable => true,
require => Package['postgresql-server'],
provider => $service_provider,
}
}