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
|
# File 'manifests/web/vspheredb.pp', line 31
class icinga::web::vspheredb (
Icinga::Secret $db_pass,
Stdlib::Ensure::Service $service_ensure = 'running',
Boolean $service_enable = true,
Enum['mysql'] $db_type = 'mysql',
Stdlib::Host $db_host = 'localhost',
Optional[Stdlib::Port] $db_port = undef,
String $db_name = 'vspheredb',
String $db_user = 'vspheredb',
Boolean $manage_database = false,
) {
icinga::prepare_web('VSphereDB')
$icingaweb2_version = $icinga::web::icingaweb2_version
$_db_charset = $db_type ? {
'mysql' => 'utf8mb4',
default => 'UTF8',
}
#
# Database
#
if $manage_database {
class { 'icinga::web::vspheredb::database':
db_type => $db_type,
db_name => $db_name,
db_user => $db_user,
db_pass => $db_pass,
web_instances => ['localhost'],
before => Class['icingaweb2::module::vspheredb'],
}
$_db_host = 'localhost'
} else {
if $db_type != 'pgsql' {
include mysql::client
} else {
include postgresql::client
}
$_db_host = $db_host
}
class { 'icingaweb2::module::vspheredb':
install_method => 'package',
db_type => $db_type,
db_host => $_db_host,
db_port => $db_port,
db_name => $db_name,
db_username => $db_user,
db_password => $db_pass,
db_charset => $_db_charset,
import_schema => lookup('icingaweb2::module::vspheredb::import_schema', undef, undef, true),
}
if versioncmp($icingaweb2_version, '4.0.0') < 0 {
service { 'icinga-vspheredb':
ensure => $service_ensure,
enable => $service_enable,
require => Class['icingaweb2::module::vspheredb'],
}
}
}
|