repo: Fix 5.0 frontend for RHEL7
MODIFY
manifests/params.pp
manifests/params.pp
@@ -166,6 +166,7 @@ class zabbix::params {
$manage_apt = true
$repo_location = undef
$unsupported_repo_location = undef
+ $frontend_repo_location = undef
$manage_resources = false
$manage_vhost = true
$database_path = '/usr/sbin'

MODIFY
manifests/repo.pp
manifests/repo.pp
@@ -35,6 +35,7 @@ class zabbix::repo (
Boolean $manage_repo = $zabbix::params::manage_repo,
Boolean $manage_apt = $zabbix::params::manage_apt,
Optional[Stdlib::HTTPUrl] $repo_location = $zabbix::params::repo_location,
+ Optional[Stdlib::HTTPUrl] $frontend_repo_location = $zabbix::params::frontend_repo_location,
Optional[Stdlib::HTTPUrl] $unsupported_repo_location = $zabbix::params::unsupported_repo_location,
String[1] $zabbix_version = $zabbix::params::zabbix_version,
) inherits zabbix::params {
@@ -93,7 +94,8 @@ class zabbix::repo (
priority => '1',
}
- if ($facts['os']['name'] == 'CentOS' and $majorrelease == '7') {
+ # Zabbix 5.0 frontend on CentOS 7 has different location.
+ if ($facts['os']['name'] == 'CentOS' and $majorrelease == '7' and $zabbix_version == '5.0') {
$_frontend_repo_location = $frontend_repo_location ? {
undef => "https://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/\$basearch/frontend",
default => $frontend_repo_location,

MODIFY
manifests/web.pp
manifests/web.pp
@@ -340,13 +340,12 @@ class zabbix::web (
],
}
}
- 'CentOS': {
+ 'CentOS', 'RedHat': {
$zabbix_web_package = 'zabbix-web'
- if ($facts['os']['release']['major'] == '7'){
-
+ if ($facts['os']['release']['major'] == '7' and $zabbix_version == '5.0') {
package { 'zabbix-required-scl-repo':
+ ensure => 'latest',
name => 'centos-release-scl',
- ensure => 'latest'
}
package { "zabbix-web-${db}-scl":
@@ -362,7 +361,6 @@ class zabbix::web (
require => Class['zabbix::repo'],
tag => 'zabbix',
}
-
}
}
default: {
@@ -409,11 +407,19 @@ class zabbix::web (
include apache::mod::proxy
include apache::mod::proxy_fcgi
$apache_vhost_custom_fragment = ''
- #php parameters are moved to /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf per package zabbix-web-deps-scl
+
+ service { 'rh-php72-php-fpm':
+ ensure => 'running',
+ enable => true,
+ }
+
+ # PHP parameters are moved to /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf per package zabbix-web-deps-scl
file { '/etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf':
ensure => file,
+ notify => Service['rh-php72-php-fpm'],
content => epp('zabbix/web/php-fpm.d.zabbix.conf.epp'),
}
+
$fcgi_filematch = {
path => '/usr/share/zabbix',
provider => 'directory',

MODIFY
spec/classes/web_spec.rb
spec/classes/web_spec.rb
@@ -53,9 +53,13 @@ describe 'zabbix::web' do
it { is_expected.not_to contain_selboolean('httpd_can_connect_zabbix') }
end
- describe 'with database_type as postgresql' do
+ %w[4.4 5.0].each do |zabbix_version|
+ describe "with database_type as postgresql and zabbix_version #{zabbix_version}" do
+ next if zabbix_version == '5.0' and %w[Debian Ubuntu].include?(facts[:osfamily]) and
+ %w[16.04 9].include?(facts[:operatingsystemmajrelease])
let :params do
super().merge(database_type: 'postgresql')
+ super().merge(zabbix_version: zabbix_version)
end
pgsqlpackage = case facts[:operatingsystem]
@@ -75,13 +79,26 @@ describe 'zabbix::web' do
'php5-pgsql'
end
- packages = facts[:osfamily] == 'RedHat' ? ['zabbix-web-pgsql', 'zabbix-web'] : ['zabbix-frontend-php', pgsqlpackage]
+ if facts[:osfamily] == 'RedHat'
+ if facts[:operatingsystemmajrelease].to_i == 7 and
+ !['VirtuozzoLinux', 'OracleLinux', 'Scientific'].include?(facts[:os]['name']) and
+ zabbix_version == '5.0'
+ packages = ['zabbix-web-pgsql-scl', 'zabbix-web']
+ else
+ packages = ['zabbix-web-pgsql', 'zabbix-web']
+ end
+ else
+ packages = ['zabbix-frontend-php', pgsqlpackage]
+ end
+
packages.each do |package|
it { is_expected.to contain_package(package) }
end
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['TYPE'\] = 'POSTGRESQL'}) }
end
+ end
+ %w[4.4 5.0].each do |zabbix_version|
describe 'with database_type as mysql' do
let :params do
super().merge(database_type: 'mysql')
@@ -110,6 +127,7 @@ describe 'zabbix::web' do
end
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php').with_content(%r{^\$DB\['TYPE'\] = 'MYSQL'}) }
end
+ end
it { is_expected.to contain_file('/etc/zabbix/web/zabbix.conf.php') }

MODIFY
spec/support/acceptance/prepare_host.rb
spec/support/acceptance/prepare_host.rb
@@ -10,6 +10,9 @@ def prepare_host
cleanup_script = <<-SHELL
/opt/puppetlabs/bin/puppet resource service zabbix-server ensure=stopped
/opt/puppetlabs/bin/puppet resource package zabbix-server-pgsql ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-server-pgsql-scl ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-web ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-frontend-php ensure=purged
rm -f /etc/zabbix/.*done
if id postgres > /dev/null 2>&1; then
su - postgres -c "psql -c 'drop database if exists zabbix_server;'"

MODIFY
templates/web/php-fpm.d.zabbix.conf.epp
templates/web/php-fpm.d.zabbix.conf.epp
-# THIS FILE IS MANAGED BY PUPPET
+;THIS FILE IS MANAGED BY PUPPET
[zabbix]
user = apache
group = apache
@@ -16,12 +16,12 @@ pm.max_spare_servers = 35
php_value[session.save_handler] = files
php_value[session.save_path] = /var/opt/rh/rh-php72/lib/php/session/
-php_value max_execution_time <%= $zabbix::web::apache_php_max_execution_time %>
-php_value memory_limit <%= $zabbix::web::apache_php_memory_limit %>
-php_value post_max_size <%= $zabbix::web::apache_php_post_max_size %>
-php_value upload_max_filesize <%= $zabbix::web::apache_php_upload_max_filesize %>
-php_value max_input_time <%= $zabbix::web::apache_php_max_input_time %>
-php_value always_populate_raw_post_data <%= $zabbix::web::apache_php_always_populate_raw_post_data %>
-php_value max_input_vars <%= $zabbix::web::apache_php_max_input_vars %>
-# Set correct timezone
-php_value date.timezone <%= $zabbix::web::zabbix_timezone %>
+php_value[max_execution_time] = <%= $zabbix::web::apache_php_max_execution_time %>
+php_value[memory_limit] = <%= $zabbix::web::apache_php_memory_limit %>
+php_value[post_max_size] = <%= $zabbix::web::apache_php_post_max_size %>
+php_value[upload_max_filesize] = <%= $zabbix::web::apache_php_upload_max_filesize %>
+php_value[max_input_time] = <%= $zabbix::web::apache_php_max_input_time %>
+php_value[always_populate_raw_post_data] = <%= $zabbix::web::apache_php_always_populate_raw_post_data %>
+php_value[max_input_vars] = <%= $zabbix::web::apache_php_max_input_vars %>
+;Set correct timezone
+php_value[date.timezone] = <%= $zabbix::web::zabbix_timezone %>

repo: Fix 5.0 frontend for RHEL7

Signed-off-by: Christos Papageorgiou <root.expert.xda@gmail.com>