Puppet Class: pgpool
- Defined in:
- manifests/init.pp
Overview
Class: pgpool
This pgpool class can be used to control the installation and configuration of pgpool for postgresql.
Parameters
- ensure
-
String. This value controls if the pacakge and various configuration files should be present or absent. Valid values are present, latest and absent. Defaults to
present
- manage_service_user
-
Boolean. This value controls if you want this class to ensure the service user exists. Defaults to
false
- config_dir
-
String. This is the path to the config dir for pgpool. If not provided, it will default to
/etc/pgpool-II-93
. Defaults toundef
- package_name
-
String. This is the package name to install for pgpool. If not provided, it will default to
pgpool-II-93
. Defaults toundef
. - postgresql_version
-
String. This is the postgresql version you are running. It is used to build the default package name and configuration dirs. If not provided, it will default to
9.3
. Defaults toundef
. - service_ensure
-
String. This is controls if the service should be running or stopped. Defaults to
running
- service_enable
-
Boolean. This controls if the service should autostart on boot. Defaults to
true
- service_user
-
String. This is the user that the service runs as and the files should be owned by. The pgpool service scripts use postgres. Defaults to
postgres
- service_group
-
String. This is the group that the service runs as and the files should be owned by. The pgpool service scripts use postgres. Defaults to
postgres
- log_user
-
String. This is the user that the log file should be owned by. Defaults to
postgres
- log_group
-
String. This is the group that the log file should be owned by. Defaults to
postgres
Variables
N/A
Examples
To install:
class { pgpool:
}
To remove:
class { pgpool:
ensure => absent,
}
Authors
Alex Schultz <aschultz@next-development.com>
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'manifests/init.pp', line 79
class pgpool (
$ensure = present,
$manage_service_user = false,
$config_dir = undef,
$package_name = undef,
$postgresql_version = undef,
$service_ensure = running,
$service_enable = true,
$service_name = undef,
$service_user = 'postgres',
$service_group = 'postgres',
$log_user = 'postgres',
$log_group = 'postgres',
) {
anchor { 'pgpool::begin': }
anchor { 'pgpool::end': }
if !($service_ensure in [running, stopped]) {
fail("service_ensure must be either running or stopped, '${service_ensure}' is not valid")
}
# setup our ensure values for various types
$file_ensure = $ensure ? {
absent => absent,
default => file,
}
$directory_ensure = $ensure ? {
absent => absent,
default => directory,
}
$service_ensure_real = $ensure ? {
absent => stopped,
default => $service_ensure
}
$service_enable_real = $ensure ? {
absent => false,
default => $service_enable
}
$postgresql_version_real = $postgresql_version ? {
undef => '9.3',
default => $postgresql_version
}
# determine what version of the package to install
$postgresql_version_short = $postgresql_version_real ? {
undef => '93',
default => regsubst($postgresql_version_real,'\.','')
}
$package_name_real = $pgpool::package_name ? {
undef => $::osfamily ? {
/RedHat/ => "pgpool-II-${postgresql_version_short}",
default => 'pgpool2',
},
default => $pgpool::package_name,
}
$service_name_real = $pgpool::service_name ? {
undef => $package_name_real,
default => $pgpool::service_name
}
class { 'pgpool::package': }
class { 'pgpool::service': }
class { 'pgpool::config': }
if ($ensure == absent) {
Anchor['pgpool::begin'] ->
Class['pgpool::service'] ->
Class['pgpool::config'] ->
Class['pgpool::package']
} else {
Anchor['pgpool::begin'] ->
Class['pgpool::package'] ->
Class['pgpool::config'] ->
Class['pgpool::service']
}
}
|