Puppet Class: cfpuppetserver::postgresql
- Defined in:
- manifests/postgresql.pp
Overview
Please see README
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'manifests/postgresql.pp', line 7
class cfpuppetserver::postgresql(
Hash
$settings_tune = {},
Cfnetwork::Port
$port = 5432,
Optional[Integer]
$node_id = undef,
Optional[String[1]]
$password = undef,
Optional[String[1]]
$version = undef,
Integer[1]
$memory_weight = 100,
Optional[Integer[1]]
$memory_max = undef,
Cfsystem::CpuWeight
$cpu_weight = 200,
Cfsystem::IoWeight
$io_weight = 200,
Optional[String[1]]
$init_db_from = undef,
) {
assert_private();
if $cfpuppetserver::postgresql {
# TODO: change to use true fact with fallback to these hardcoded values
$psql_version = $::facts['operatingsystem'] ? {
'Debian' => $::facts['operatingsystemrelease'] ? {
'8' => '9.4',
'9' => '9.6',
'10' => '11',
default => '11',
},
'Ubuntu' => $::facts['operatingsystemrelease'] ? {
'15.10' => '9.4',
'16.04' => '9.5',
'16.10' => '9.5',
'17.04' => '9.6',
'17.10' => '9.6',
'18.04' => '10',
default => '10',
},
default => undef
}
$def_init_db_from = empty($psql_version) ? {
true => '',
default => "${psql_version}:/var/lib/postgresql/${psql_version}/main/"
}
$cfdb_settings = {
secure_cluster => true,
node_id => $node_id,
init_db_from => pick_default($init_db_from, $def_init_db_from),
}
$databases = $cfpuppetserver::is_secondary ? {
false => {
"${cfpuppetserver::database}" => {
roles => {
ro => {
readonly => true,
}
},
ext => ['pg_trgm'],
}
},
default => undef,
}
class { 'cfdb::postgresql':
version => $version,
default_extensions => false,
# virtual package since v10
# extensions2 => ['contrib'],
}
-> cfdb::instance{ $cfpuppetserver::cluster:
type => 'postgresql',
is_cluster => $cfpuppetserver::is_cluster,
is_secondary => $cfpuppetserver::is_secondary,
is_arbitrator => $cfpuppetserver::is_arbitrator,
iface => $cfpuppetserver::iface,
port => $port,
settings_tune => merge($settings_tune, {
cfdb => $cfdb_settings,
}),
databases => $databases,
memory_weight => $memory_weight,
memory_max => $memory_max,
cpu_weight => $cpu_weight,
io_weight => $io_weight,
}
}
}
|