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
|
# File 'manifests/init.pp', line 11
class pe_databases (
# Manage the inclusion of the pg_repack class
Boolean $manage_database_maintenance = true,
# Manage the state of the maintenance tasks, i.e. systemd services and timers
Boolean $disable_maintenance = lookup('pe_databases::disable_maintenance', {'default_value' => false}),
Boolean $manage_postgresql_settings = true,
Boolean $manage_table_settings = false,
String $install_dir = '/opt/puppetlabs/pe_databases',
String $scripts_dir = "${install_dir}/scripts"
) {
$psql_version = $facts['pe_postgresql_info']['installed_server_version'] ? {
undef => undef,
default => String($facts['pe_postgresql_info']['installed_server_version'])
}
file { [$install_dir, $scripts_dir] :
ensure => directory,
mode => '0755',
}
exec { 'pe_databases_daemon_reload':
command => 'systemctl daemon-reload',
path => ['/bin', '/usr/bin'],
refreshonly => true,
}
if $facts.dig('pe_databases', 'have_systemd') {
if versioncmp('2019.0.2', $facts['pe_server_version']) <= 0 {
if $manage_database_maintenance {
class {'pe_databases::pg_repack':
disable_maintenance => $disable_maintenance,
}
if $manage_table_settings {
# This is to provide for situations, like PE XL,
# where the pe-puppetdb database does not exist on the PostgreSQL system being tuned.
# In PE XL, the Primary and Replica run PostgreSQL for all databases *except* for pe-puppetdb.
include pe_databases::postgresql_settings::table_settings
}
}
}
else {
notify { 'pe_databases_version_warn':
message => 'This module only supports PE 2019.0.2 and later',
loglevel => warning,
}
}
}
else {
notify { 'pe_databases_systemd_warn':
message => 'This module only works with systemd as the provider',
loglevel => warning,
}
}
}
|