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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'manifests/web/director.pp', line 43
class icinga::web::director (
Icinga::Secret $db_pass,
Icinga::Secret $api_pass,
String $endpoint,
Stdlib::Ensure::Service $service_ensure = 'running',
Boolean $service_enable = true,
Enum['mysql', 'pgsql'] $db_type = 'mysql',
Stdlib::Host $db_host = 'localhost',
Optional[Stdlib::Port] $db_port = undef,
String $db_name = 'director',
String $db_user = 'director',
Boolean $manage_database = false,
Stdlib::Host $api_host = 'localhost',
String $api_user = 'director',
) {
icinga::prepare_web('Director')
$icingaweb2_version = $icinga::web::icingaweb2_version
#
# Database
#
if $manage_database {
class { 'icinga::web::director::database':
db_type => $db_type,
db_name => $db_name,
db_user => $db_user,
db_pass => $db_pass,
web_instances => ['localhost'],
before => Class['icingaweb2::module::director'],
}
$_db_host = 'localhost'
} else {
if $db_type != 'pgsql' {
include mysql::client
} else {
include postgresql::client
}
$_db_host = $db_host
}
class { 'icingaweb2::module::director':
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,
import_schema => true,
kickstart => true,
endpoint => $endpoint,
api_host => $api_host,
api_username => $api_user,
api_password => $api_pass,
db_charset => 'UTF8',
}
class { 'icingaweb2::module::fileshipper':
install_method => 'package',
}
# dirty hack around deamon restart
# after pdo_psql is available
Package[$icingaweb2::module::director::package_name, $icingaweb2::module::fileshipper::package_name]
~> exec { 'restart icinga-director daemon':
path => $facts['path'],
command => 'systemctl restart icinga-director',
refreshonly => true,
onlyif => 'systemctl status icinga-director',
}
if versioncmp($icingaweb2_version, '4.0.0') < 0 {
class { 'icingaweb2::module::director::service':
ensure => $service_ensure,
enable => $service_enable,
}
}
}
|