2012-06-08 22:37:21 +02:00
|
|
|
# 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,
|
|
|
|
}
|
|
|
|
|
2012-06-08 23:00:24 +02:00
|
|
|
$config_class = {}
|
|
|
|
$config_class['postgresql::config'] = $config_hash
|
|
|
|
|
|
|
|
create_resources( 'class', $config_class )
|
|
|
|
|
|
|
|
Package['postgresql-server'] -> Class['postgresql::config']
|
|
|
|
|
2012-06-08 22:37:21 +02:00
|
|
|
if ($needs_initdb) {
|
|
|
|
include postgresql::initdb
|
|
|
|
|
2012-06-08 23:00:24 +02:00
|
|
|
Class['postgresql::initdb'] -> Class['postgresql::config']
|
2012-06-08 22:37:21 +02:00
|
|
|
Class['postgresql::initdb'] -> Service['postgresqld']
|
|
|
|
}
|
|
|
|
|
|
|
|
service { 'postgresqld':
|
|
|
|
name => $service_name,
|
|
|
|
ensure => running,
|
|
|
|
enable => true,
|
|
|
|
require => Package['postgresql-server'],
|
|
|
|
provider => $service_provider,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|