Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove old version comparison guards for Zabbix pre 5.0 #906

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,7 @@
$proxy_zabbix_server_host = undef
$proxy_zabbix_server_port = '10051'
$proxy_zbx_templates = ['Template App Zabbix Proxy']
$proxy_socketdir = versioncmp($zabbix_version, '5.0') ? {
-1 => undef,
default => '/var/run/zabbix',
}
$proxy_socketdir = '/var/run/zabbix'

# Java Gateway specific params
$javagateway_listenip = '0.0.0.0'
Expand Down
2 changes: 1 addition & 1 deletion manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
}
}

if ($facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) {
if ($facts['os']['release']['major'] == '7') {
case $facts['os']['name'] {
'CentOS': {
$scl_package_name = 'centos-release-scl'
Expand Down
28 changes: 9 additions & 19 deletions manifests/web.pp
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@
fail("${facts['os']['family']} is currently not supported for zabbix::web")
}

# zabbix frontend 5.x is not supported, among others, on stretch and xenial.
# https://www.zabbix.com/documentation/current/manual/installation/frontend/frontend_on_debian
if $facts['os']['name'] in ['ubuntu', 'debian'] and versioncmp($zabbix_version, '5') >= 0 {
if versioncmp($facts['os']['release']['major'], '9') == 0 {
fail("${facts['os']['family']} ${$facts['os']['release']['major']} is not supported for zabbix::web")
}
}

# Only include the repo class if it has not yet been included
unless defined(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
Expand Down Expand Up @@ -231,7 +223,7 @@
}
'RedHat': {
$zabbix_web_package = 'zabbix-web'
if ($facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) {
if ($facts['os']['release']['major'] == '7') {
package { "zabbix-web-${db}-scl":
ensure => $zabbix_package_state,
before => Package[$zabbix_web_package],
Expand Down Expand Up @@ -285,22 +277,20 @@
}

# For API to work on Zabbix 5.x zabbix.conf.php needs to be in the root folder.
if versioncmp($zabbix_version, '5') >= 0 {
file { '/etc/zabbix/zabbix.conf.php':
ensure => link,
target => '/etc/zabbix/web/zabbix.conf.php',
owner => $web_config_owner,
group => $web_config_group,
mode => '0640',
}
file { '/etc/zabbix/zabbix.conf.php':
ensure => link,
target => '/etc/zabbix/web/zabbix.conf.php',
owner => $web_config_owner,
group => $web_config_group,
mode => '0640',
}

# Is set to true, it will create the apache vhost.
if $manage_vhost {
include apache
include apache::mod::dir
if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '7') >= 0 and versioncmp($zabbix_version, '5') >= 0 {
if versioncmp($facts['os']['release']['major'], '7') == 0 {
if $facts['os']['family'] == 'RedHat' {
if $facts['os']['release']['major'] == '7' {
$fpm_service = 'rh-php72-php-fpm'
# PHP parameters are moved to /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf per package zabbix-web-deps-scl
$fpm_scl_prefix = '/opt/rh/rh-php72'
Expand Down
5 changes: 2 additions & 3 deletions spec/classes/web_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class { 'apache':
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
it { is_expected.to contain_service('rh-php72-php-fpm') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
it { is_expected.to contain_file('/etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
it { is_expected.to contain_file('/etc/zabbix/zabbix.conf.php') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && Puppet::Util::Package.versioncmp(zabbix_version, '5.0') >= 0
it { is_expected.to contain_file('/etc/zabbix/zabbix.conf.php') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
it { is_expected.to contain_service('php-fpm') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] >= '8'
it { is_expected.to contain_file('/etc/php-fpm.d/zabbix.conf') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] >= '8'
end
Expand Down Expand Up @@ -91,8 +91,7 @@ class { 'apache':

packages = if facts[:os]['family'] == 'RedHat'
if facts[:os]['release']['major'].to_i == 7 &&
!%w[VirtuozzoLinux OracleLinux Scientific].include?(facts[:os]['name']) &&
Puppet::Util::Package.versioncmp(zabbix_version, '5.0') >= 0
!%w[VirtuozzoLinux OracleLinux Scientific].include?(facts[:os]['name'])
%w[zabbix-web-pgsql-scl zabbix-web]
else
%w[zabbix-web-pgsql zabbix-web]
Expand Down
14 changes: 0 additions & 14 deletions templates/zabbix_agentd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ DebugLevel=<%= @debuglevel %>
#
<% if @sourceip %>SourceIP=<%= @sourceip %><% end %>

<% if @zabbix_version.to_f >= 5.0 %>
### Option: AllowKey
# Allow execution of item keys matching pattern.
# Multiple keys matching rules may be defined in combination with DenyKey.
Expand All @@ -72,16 +71,6 @@ DebugLevel=<%= @debuglevel %>
# Mandatory: no
# Default:
<% if @denykey %>DenyKey=<%= @denykey -%><% end %>
<% end %>

<% if @zabbix_version.to_f < 5.0 %>
### Option: EnableRemoteCommands
# Whether remote commands from Zabbix server are allowed.
# 0 - not allowed
# 1 - allowed
#
EnableRemoteCommands=<%= @enableremotecommands %>
<% end %>

### Option: LogRemoteCommands
# Enable logging of executed shell commands as warnings.
Expand Down Expand Up @@ -375,7 +364,6 @@ LoadModulePath=<%= @loadmodulepath %>
# TLSPSKFile=
<% if @tlspskfile %>TLSPSKFile=<%= @tlspskfile %><% end %>

<% if @zabbix_version.to_f >= 5.0 %>
### Option: TLSCipherCert13
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
# Override the default ciphersuite selection criteria for certificate-based encryption.
Expand Down Expand Up @@ -439,5 +427,3 @@ LoadModulePath=<%= @loadmodulepath %>
# Mandatory: no
# Default:
<% if @tlscipherall %>TLSCipherAll=<%= @tlscipherall %><% end %>

<% end %>
6 changes: 0 additions & 6 deletions templates/zabbix_proxy.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ DebugLevel=<%= @debuglevel %>
#
PidFile=<%= @pidfile %>

<% if @zabbix_version.to_f >= 5.0 %>
### Option: SocketDir
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
Expand All @@ -94,7 +93,6 @@ PidFile=<%= @pidfile %>
# Default:

<% if @socketdir %>SocketDir=<%= @socketdir %><% end %>
<% end %>

### Option: DBHost
# Database host name.
Expand Down Expand Up @@ -516,7 +514,6 @@ LoadModulePath=<%= @loadmodulepath %>
<% if @tlspskfile %>TLSPSKFile=<%= @tlspskfile %><% end %>

####### For advanced users - TLS ciphersuite selection criteria #######
<% if @zabbix_version.to_f >= 5.0 %>
### Option: DBTLSConnect
# Setting this option enforces to use TLS connection to database.
# required - connect using TLS
Expand Down Expand Up @@ -572,9 +569,7 @@ LoadModulePath=<%= @loadmodulepath %>
# Mandatory no
# Default:
<% if @database_tlscipher13 %>DBTLSCipher13=<%= @database_tlscipher13 %><% end %>
<% end %>

<% if @zabbix_version.to_f >= 5.0 %>
### Option: TLSCipherCert13
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
# Override the default ciphersuite selection criteria for certificate-based encryption.
Expand Down Expand Up @@ -644,7 +639,6 @@ LoadModulePath=<%= @loadmodulepath %>
# Default:
# TLSCipherAll13=
<% if @tlscipherall %>TLSCipherAll=<%= @tlscipherall %><% end %>
<% end %>

<% if @zabbix_version.to_f >= 5.2 %>
### Option: VaultToken
Expand Down
6 changes: 0 additions & 6 deletions templates/zabbix_server.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ ProxyConfigFrequency=<%= @proxyconfigfrequency %>
#
ProxyDataFrequency=<%= @proxydatafrequency %>

<% if @zabbix_version.to_f >= 5.0 %>
### Option: StartLLDProcessors
# Number of pre-forked instances of low level discovery processors.
#
Expand All @@ -393,7 +392,6 @@ ProxyDataFrequency=<%= @proxydatafrequency %>
# Default:
# StartLLDProcessors=2
<% if @startlldprocessors %>StartLLDProcessors=<%= @startlldprocessors -%><% end %>
<% end %>

### Option: AllowRoot
# Allow the server to run as 'root'. If disabled and the server is started by 'root', the server
Expand Down Expand Up @@ -490,7 +488,6 @@ LoadModulePath=<%= @loadmodulepath %>
<% if @tlskeyfile %>TLSKeyFile=<%= @tlskeyfile %><% end %>

####### For advanced users - TLS ciphersuite selection criteria #######
<% if @zabbix_version.to_f >= 5.0 %>
### Option: DBTLSConnect
# Setting this option enforces to use TLS connection to database.
# required - connect using TLS
Expand Down Expand Up @@ -546,9 +543,7 @@ LoadModulePath=<%= @loadmodulepath %>
# Mandatory no
# Default:
<% if @database_tlscipher13 %>DBTLSCipher13=<%= @database_tlscipher13 %><% end %>
<% end %>

<% if @zabbix_version.to_f >= 5.0 %>
### Option: TLSCipherCert13
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
# Override the default ciphersuite selection criteria for certificate-based encryption.
Expand Down Expand Up @@ -618,7 +613,6 @@ LoadModulePath=<%= @loadmodulepath %>
# Default:
# TLSCipherAll13=
<% if @tlscipherall %>TLSCipherAll=<%= @tlscipherall %><% end %>
<% end %>

<% if @zabbix_version.to_f >= 5.2 %>
### Option: VaultToken
Expand Down