1
2
3
4
5
6
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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
|
# File 'manifests/params.pp', line 1
class clustercontrol::params ($online_install = true, $only_cc_v2 = true) {
$repo_host = 'repo.severalnines.com'
$cc_controller = 'clustercontrol-controller'
$cc_ui = 'clustercontrol'
$cc_ui2 = 'clustercontrol2'
$cc_cloud = 'clustercontrol-cloud'
$cc_clud = 'clustercontrol-clud'
$cc_ssh = 'clustercontrol-ssh'
$cc_notif = 'clustercontrol-notifications'
$libs9s = 'libs9s'
$s9stools = 's9s-tools'
$cmon_conf = '/etc/cmon.cnf'
$cmon_sql_path = '/usr/share/cmon'
$apache_httpd_extra_options = 'Require all granted'
$format = "%i"
$a_version_no = scanf($operatingsystemmajrelease, $format)
$os_majrelease = $a_version_no[0]
/*notice(">>>>>> CC Debugger >>>>>> value is: $os_majrelease + ${operatingsystemmajrelease}")*/
$typevar = type($os_majrelease)
$lower_operatingsystem = downcase($operatingsystem)
$cc_v2_config_ui_file = "/var/www/html/clustercontrol2/config.js"
notice(">>>>>> CC Debugger >>>>>> value is: $osfamily + ${operatingsystemmajrelease}")
case $osfamily {
'Redhat': {
if ($operatingsystem == 'RedHat') {
$s9s_tools_repo_osname = "RHEL_${operatingsystemmajrelease}"
} else {
$s9s_tools_repo_osname = "${operatingsystem}_${operatingsystemmajrelease}"
}
if ($os_majrelease >= 10) {
fail("ClusterControl has no support for RHEL versions >= 10.")
}
if ($os_majrelease >= 9) {
# RHEL/CentOS v 9.x and up
$mailer = 's-nail'
## fail for now since we don't support PHP 8.x which is the default shipped package for
## RHEL/CentOS/Rocky/AlmaLinux/Oracle 9.x
if (! $only_cc_v2) {
notice(
"This Puppet Module ClusterControl only supports RHEL/CentOS/Rocky/AlmaLinux/Oracle >= 7 to 8.x versions only.
Enterprise Linux version 9.x has PHP 8.x versions which we don't support as of this time.
ClusterControl UI version 1 does not support PHP 8.x, so if it don't work,
you need to downgrade your PHP 8.x to PHP 7.x version"
)
notify {"Setting up PHP 7 ...": }
exec { 'yum-install-remi-release-9' :
path => ['/bin','/usr/bin'],
command => 'dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm',
unless => 'rpm -qa|egrep -i remi'
}
package { 'php:module':
ensure => disabled,
name => 'php',
provider => dnfmodule, # Configs module, not package
}
package { 'php:remi-7.4': # Use resource title to choose stream
ensure => present,
provider => dnfmodule,
enable_only => true, # Don't install whole module
}
# yum install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
# yum module reset php
# yum module enable php:remi-7.4 -y
notify {"Using PHP 7 repository ...": }
}
} else {
$mailer = 'mailx'
}
$php_packages_inc = ['php', 'php-gd', 'php-fpm', 'php-xml', 'php-json', 'php-ldap']
$cc_packages = [
'clustercontrol-notifications', 'clustercontrol-ssh', 'clustercontrol-cloud', 'clustercontrol-clud', 's9s-tools'
]
if ($online_install) {
$loc_dependencies = ['httpd', 'wget', $mailer, 'curl', 'cronie', 'bind-utils', 'mod_ssl', 'openssl', 'nmap-ncat']
} else {
$loc_dependencies = [
'httpd', 'wget', 'curl', 'cronie', 'bind-utils', 'mod_ssl', 'openssl',
'nmap-ncat', 'gnuplot', 'expect','perl-XML-XPath', $mailer, 'psmisc'
]
}
$apache_conf_file = "/etc/httpd/conf/httpd.conf"
$apache_security_conf_file = "/etc/httpd/conf.d/security.conf"
$apache_log_dir = "/var/log/httpd/"
$apache_s9s_conf_file = '/etc/httpd/conf.d/s9s.conf'
$apache_s9s_ssl_conf_file = '/etc/httpd/conf.d/ssl.conf'
$apache_s9s_cc_frontend_conf_file = '/etc/httpd/conf.d/cc-frontend.conf'
$apache_s9s_cc_proxy_conf_file = '/etc/httpd/conf.d/cc-proxy.conf'
$cert_file = '/etc/pki/tls/certs/s9server.crt'
$key_file = '/etc/pki/tls/private/s9server.key'
$apache_user = 'apache'
$apache_service = 'httpd'
$wwwroot = '/var/www/html'
$mysql_cnf = '/etc/my.cnf'
$mysql_service = 'mariadb'
$mysql_packages = ['mariadb','mariadb-server']
if ($os_majrelease == 7) {
$php_packages = $php_packages_inc + ['php-mysql']
} elsif ($os_majrelease > 7) {
# RHEL/CentOS v 8.0 and up
$php_packages = $php_packages_inc + ['php-mysqlnd']
} else {
fail("This Puppet Module ClusterControl only supports RHEL/CentOS >= 7 versions. Obsolete or versions that passed EOL is no longer supported. Please contact Severalnines (support@severalnines.com) if you see unusual behavior.")
}
if ($only_cc_v2) {
$cc_dependencies = $loc_dependencies + $cc_packages
} else {
$cc_dependencies = $loc_dependencies + $php_packages + $cc_packages
}
/*notify{"<<<<<<<<<<<<<CC Debugger:>>>>>>>>>>>>>s9s tool reponame: ${$s9s_tools_repo_osname}, \
os_majrelease: ${$os_majrelease}, ${cc_hostname_lo}, codename: ${lsbdistcodename} , \
os_majrelease: ${os_majrelease} and data-type is: ${typevar}), \
cc_dependencies: ${cc_dependencies}":
}*/
if ($online_install) {
## Execute repo fetch and updates for s9s only when has internet connection or access to s9s site.
yumrepo {
"s9s-repo":
descr => "Severalnines Repository",
baseurl => "http://$repo_host/rpm/os/x86_64",
enabled => 1,
gpgkey => "http://$repo_host/severalnines-repos.asc",
gpgcheck => 1
}
yumrepo {
"s9s-tools-repo":
descr => "s9s-tools $s9s_tools_repo_osname",
baseurl => "http://$repo_host/s9s-tools/$s9s_tools_repo_osname",
enabled => 1,
gpgkey => "http://$repo_host/s9s-tools/$s9s_tools_repo_osname/repodata/repomd.xml.key",
gpgcheck => 1
}
$severalnines_repo = Yumrepo[["s9s-repo","s9s-tools-repo"]]
}
}
'Debian': {
if ($operatingsystem == 'Ubuntu' and $os_majrelease >= 18) or ($operatingsystem == 'Debian' and $os_majrelease > 7) {
/*notify{"<<<<<<<<<<<<<CC Debugger:>>>>>>>>>>>>>The value is: ${lower_operatingsystem} and ${cc_hostname_lo} and ${lsbdistcodename} and ${os_majrelease} and data-type is: ${typevar})": }*/
# notify{"<<<<<<<<<<<<<CC Debugger:>>>>>>>>>>>>>The value is: ${lower_operatingsystem} and ${cc_hostname_lo} and ${lsbdistcodename} and ${os_majrelease} and data-type is: ${typevar})": }
/*notify{"<<<<<<<<<<<<<CC Debugger:>>>>>>>>>>>>>The value is: ${lower_operatingsystem} and ${cc_hostname_lo} and ${lsbdistcodename} and ${os_majrelease} and data-type is: ${typevar})": }*/
if (($operatingsystem == 'Ubuntu' and $os_majrelease >= 23) or (operatingsystem == 'Debian' and $os_majrelease >= 11)) {
fail("ClusterControl has no support yet to Ubuntu versions >= 23 or Debian >= 11.")
}
if ($only_cc_v2 == false and $operatingsystem == 'Ubuntu' and $os_majrelease >= 22) {
## only CC v1 requires PHP
# Jhammy and up
## fail for now since we don't support PHP 8.x which is the default shipped package for
# Ubuntu Jhammy and up
notify {"ClusterControl UI version 1 does not support PHP 8.x version.": }
notify {"Instead, ClusterControl will downgrade and setup PHP 7 for you...": }
notify {"Setting up PHP 7 ...": }
exec { 'apt-update-for-php7-prep' :
path => ['/bin','/usr/bin'],
command => 'apt-get update'
}
package { 'software-properties-common':
ensure => installed
}
package { 'apt-transport-https':
ensure => installed
}
exec { 'add-apt-php7-repo' :
path => ['/bin','/usr/bin'],
command => 'add-apt-repository -y ppa:ondrej/php'
}
notify {"Using PHP 7 repository ...": }
}
$apache_log_dir = "/var/log/apache2/"
$wwwroot = '/var/www/html'
$apache_conf_file = "/etc/apache2/apache2.conf"
$apache_s9s_conf_file = '/etc/apache2/sites-available/s9s.conf'
$apache_s9s_target_file = '/etc/apache2/sites-enabled/001-s9s.conf'
$apache_s9s_ssl_conf_file = '/etc/apache2/sites-available/s9s-ssl.conf'
$apache_s9s_ssl_target_file = '/etc/apache2/sites-enabled/001-s9s-ssl.conf'
$apache_s9s_cc_frontend_conf_file = '/etc/apache2/sites-available/cc-frontend.conf'
$apache_s9s_cc_frontend_target_file = '/etc/apache2/sites-enabled/cc-frontend.conf'
$apache_s9s_cc_proxy_conf_file = '/etc/apache2/sites-available/cc-proxy.conf'
$apache_s9s_cc_proxy_target_file = '/etc/apache2/sites-enabled/cc-proxy.conf'
$apache_security_conf_file = "//etc/apache2/conf-available/security.conf"
$apache_security_target_conf_file = "/etc/apache2/conf-enabled/security.conf"
$apache_mods_header_file = '/etc/apache2/mods-available/headers.load'
$apache_mods_header_target_file = '/etc/apache2/mods-enabled/headers.load'
$cert_file = '/etc/ssl/certs/s9server.crt'
$key_file = '/etc/ssl/private/s9server.key'
$apache_user = 'www-data'
$apache_service = 'apache2'
$mysql_service = 'mysql'
$mysql_cnf = '/etc/mysql/my.cnf'
$repo_source = '/etc/apt/sources.list.d/s9s-repo.list'
$repo_tools_src = '/etc/apt/sources.list.d/s9s-tools.list'
if ($operatingsystem == 'Debian') {
$mysql_packages = ['mariadb-client','mariadb-server']
} else {
$mysql_packages = ['mysql-client','mysql-server']
}
if ($only_cc_v2) {
## php is not needed for ccv2
$php_packages = []
} else {
if ($operatingsystem == 'Ubuntu' and $os_majrelease >= 22) {
## jammy
$php_packages = [
'php7.4-mysql', 'php7.4-gd', 'libapache2-mod-php7.4', 'php7.4-curl',
'php7.4-ldap', 'php7.4-xml', 'php7.4-json'#, 'php7.4-fpm',
]
} else {
$php_packages = [
'php-mysql', 'php-gd', 'libapache2-mod-php', 'php-curl',
'php-ldap', 'php-xml', 'php-json'#, 'php-fpm',
]
}
}
if ($online_install) {
$cc_packges = [
'clustercontrol-notifications', 'clustercontrol-ssh',
'clustercontrol-cloud', 'clustercontrol-clud', 's9s-tools'
]
$cc_dependencies = ['apache2', 'wget', 'mailutils', 'curl', 'dnsutils'] + $php_packages + $cc_packges
} else {
$cc_dependencies = ['apache2', 'wget', 'mailutils', 'curl', 'dnsutils'] + $php_packages
}
/* Remove unwanted config files, retain only s9s config files */
file {
[
'/etc/apache2/sites-enabled/000-default.conf',
'/etc/apache2/sites-enabled/default-ssl.conf',
'/etc/apache2/sites-enabled/001-default-ssl.conf'
] :
ensure => absent,
require => Package[$cc_dependencies]
}
} else {
fail("This Puppet Module ClusterControl only supports Ubuntu >= 16 versions and Debian >=9 versions.
Obsolete or versions that passed EOL is no longer supported. Please contact Severalnines (support@severalnines.com)
if you see unusual behavior.")
/*
$wwwroot = '/var/www'
$apache_s9s_conf_file = '/etc/apache2/sites-available/000-default.conf'
$apache_s9s_target_file = '/etc/apache2/sites-enabled/000-default.conf'
$apache_s9s_ssl_conf_file = '/etc/apache2/sites-available/default-ssl.conf'
$apache_s9s_ssl_target_file = '/etc/apache2/sites-enabled/default-ssl.conf'
$apache_httpd_extra_options = ''
*/
}
if ($online_install) {
## Execute repo fetch and updates for s9s only when has internet connection or access to s9s site.
exec { 'apt-update-severalnines' :
path => ['/bin','/usr/bin'],
command => 'apt-get update',
require => File[
["$clustercontrol::params::repo_source"],
["$clustercontrol::params::repo_tools_src"]
],
refreshonly => true
}
## gpg ensures in Debian Bullseye not to fail (ensuring gpg is installed)
package { 'gpg' :
ensure => "installed",
}
exec { 'import-severalnines-key' :
path => ['/bin','/usr/bin'],
command => "wget -qO - http://$clustercontrol::params::repo_host/severalnines-repos.asc | apt-key add -",
require => Package["gpg"]
}
exec { 'import-severalnines-tools-key' :
path => ['/bin','/usr/bin'],
command => "wget -qO - http://$clustercontrol::params::repo_host/s9s-tools/$lsbdistcodename/Release.key | apt-key add -",
require => Package["gpg"]
}
file { "$repo_source":
content => template('clustercontrol/s9s-repo.list.erb'),
require => Exec['import-severalnines-key'],
notify => Exec['apt-update-severalnines']
}
file { "$repo_tools_src":
content => template('clustercontrol/s9s-tools.list.erb'),
require => Exec['import-severalnines-tools-key'],
notify => Exec['apt-update-severalnines']
}
$severalnines_repo = Exec['apt-update-severalnines']
}
}
'Suse': {
if (Integer($operatingsystemmajrelease) >= 15) {
if ($operatingsystemmajrelease == '15') {
$s9s_tools_repo_osname = "${operatingsystemrelease}"
} else {
$s9s_tools_repo_osname = "${operatingsystem}_${operatingsystemrelease}"
}
if ($only_cc_v2) {
## no php packages
$php_packages = []
} else {
$php_packages = [
'php7', 'php7-mysql', 'apache2-mod_php7', 'php7-gd', 'php7-curl', 'php7-ldap',
'php7-xmlreader', 'php7-ctype', 'php7-json',
]
}
$cc_packages = ['clustercontrol-notifications', 'clustercontrol-ssh', 'clustercontrol-cloud', 'clustercontrol-clud', 's9s-tools']
if ($online_install) {
$loc_dependencies = [
'apache2', 'wget', 'mailx', 'curl', 'cronie', 'bind-utils',
## shall fix the issues with systemd and sysvinit scripts
'insserv-compat', 'sysvinit-tools',
'openssl', 'ca-certificates',
'gnuplot', 'expect', 'perl-XML-XPath', 'psmisc',
#'mod_ssl'
]
} else {
$loc_dependencies = [
'apache2', 'wget', 'mailx', 'curl', 'cronie', 'bind-utils', 'insserv-compat', 'sysvinit-tools',
'openssl', 'ca-certificates', 'gnuplot', 'expect', 'perl-XML-XPath', 'psmisc',
#'mod_ssl'
]
}
/*notify{"<<<<<<<<<<<<<CC Debugger:>>>>>>>>>>>>>The value is: ${lower_operatingsystem} and ${cc_hostname_lo} and ${lsbdistcodename} and ${os_majrelease} and data-type is: ${typevar})": }*/
#$apache_s9s_conf_file = '/etc/apache2/vhosts.d/s9s.conf'
$apache_s9s_conf_file = '/etc/apache2/vhosts.d/s9s.conf'
$apache_s9s_ssl_conf_file = '/etc/apache2/vhosts.d/ssl.conf'
$apache_s9s_cc_frontend_conf_file = '/etc/apache2/vhosts.d/cc-frontend.conf'
$apache_s9s_cc_proxy_conf_file = '/etc/apache2/vhosts.d/cc-proxy.conf'
$cert_file = '/etc/ssl/certs/s9server.crt'
$key_file = '/etc/ssl/private/s9server.key'
$apache_user = 'wwwrun'
$apache_service = 'apache2'
$apache_log_dir = "/var/log/apache2/"
$wwwroot = '/var/www/html'
$mysql_cnf = '/etc/my.cnf'
if (Integer($operatingsystemmajrelease) >= 15) {
$mysql_service = 'mariadb'
$mysql_packages = ['mariadb','mariadb-client']
$cc_dependencies = $loc_dependencies + $php_packages + $cc_packages
} else {
fail("This Puppet Module ClusterControl only supports SUSE/OpenSUSE >= 15 versions. " +
"Obsolete or versions that passed EOL is no longer supported. Please contact " +
"Severalnines (support@severalnines.com) if you see unusual behavior.")
}
} else {
fail("This Puppet Module ClusterControl only supports SUSE/OpenSUSE >= 15 versions. " +
"Obsolete or versions that passed EOL is no longer supported. Please contact " +
"Severalnines (support@severalnines.com) if you see unusual behavior.")
}
if ($online_install) {
## Execute repo fetch and updates for s9s only when has internet connection or access to s9s site.
zypprepo {
"s9s-repo":
descr => "Severalnines Repository",
baseurl => "http://$repo_host/rpm/os/x86_64",
enabled => 1,
gpgkey => "http://$repo_host/severalnines-repos.asc",
gpgcheck => 1
}
zypprepo {
"s9s-tools-repo":
descr => "s9s-tools - $s9s_tools_repo_osname",
baseurl => "http://$repo_host/s9s-tools/$s9s_tools_repo_osname",
enabled => 1,
gpgkey => "http://$repo_host/s9s-tools/$s9s_tools_repo_osname/repodata/repomd.xml.key",
gpgcheck => 1
}
}
}
default: {
fail("This Puppet Module ClusterControl only supports RHEL/CentOS >= 7, Ubuntu >= 16, Debian >= 9 versions. Obsolete or versions that passed EOL is no longer supported. Please contact Severalnines (support@severalnines.com) if you see unusual behavior.")
}
}
}
|