Skip to content

Commit

Permalink
Merge pull request #970 from Valantin/del/el7
Browse files Browse the repository at this point in the history
Remove EL7 support
  • Loading branch information
bastelfreak authored Oct 2, 2024
2 parents 24993d4 + 1804ea3 commit feb6014
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 209 deletions.
2 changes: 0 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@

if downcase($facts['kernel']) == 'windows' {
$zabbix_version = '4.4.5'
} elsif $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7' {
$zabbix_version = '5.0'
} else {
$zabbix_version = '6.0'
}
Expand Down
45 changes: 6 additions & 39 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@
case $facts['os']['family'] {
'RedHat': {
$majorrelease = $facts['os']['release']['major']
if (versioncmp(fact('os.release.major'), '7') >= 0 and $zabbix_version == '7.0') {
if versioncmp($zabbix_version, '7.0') >= 0 {
$gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005'
$gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005'
if versioncmp(fact('os.release.major'), '9') >= 0 {
$gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD'
} else {
$gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005'
}
} elsif versioncmp(fact('os.release.major'), '9') >= 0 {
$gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD'
$gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD'
Expand Down Expand Up @@ -59,43 +63,6 @@
gpgkey => $gpgkey_nonsupported,
priority => '1',
}

# Zabbix 5.0 frontend on EL7 has different location.
if ($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,
}

yumrepo { 'zabbix-frontend':
name => "Zabbix_frontend_${majorrelease}_${facts['os']['architecture']}",
descr => "Zabbix_frontend_${majorrelease}_${facts['os']['architecture']}",
baseurl => $_frontend_repo_location,
gpgcheck => '1',
gpgkey => $gpgkey_zabbix,
priority => '1',
}
}

if ($facts['os']['release']['major'] == '7') {
case $facts['os']['name'] {
'CentOS': {
$scl_package_name = 'centos-release-scl'
}
'OracleLinux': {
$scl_package_name = 'oracle-softwarecollection-release-el7'
}
default: {
$scl_package_name = undef
}
}
if $scl_package_name {
package { 'zabbix-required-scl-repo':
ensure => 'latest',
name => $scl_package_name,
}
}
}
}
'Debian': {
if ($manage_apt) {
Expand Down
8 changes: 0 additions & 8 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,6 @@
Optional[String[1]] $hanodename = $zabbix::params::server_hanodename,
Optional[String[1]] $nodeaddress = $zabbix::params::server_nodeaddress,
) inherits zabbix::params {
# zabbix server 5.2, 5.4 and 6.0 is not supported on RHEL 7.
# https://www.zabbix.com/documentation/current/manual/installation/install_from_packages/rhel_centos
if $facts['os']['family'] == 'RedHat' and versioncmp($zabbix_version, '5.2') >= 0 {
if versioncmp($facts['os']['release']['major'], '7') == 0 {
fail("${facts['os']['family']} ${$facts['os']['release']['major']} is not supported for zabbix::server (version ${$zabbix_version}) (yet)")
}
}

# Only include the repo class if it has not yet been included
unless defined(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
Expand Down
34 changes: 4 additions & 30 deletions manifests/web.pp
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,6 @@
],
}
}
'RedHat': {
$zabbix_web_package = 'zabbix-web'
if ($facts['os']['release']['major'] == '7') {
package { "zabbix-web-${db}-scl":
ensure => $zabbix_package_state,
before => Package[$zabbix_web_package],
require => Class['zabbix::repo'],
tag => 'zabbix',
}
} else {
package { "zabbix-web-${db}":
ensure => $zabbix_package_state,
before => Package[$zabbix_web_package],
require => Class['zabbix::repo'],
tag => 'zabbix',
}
}
}
default: {
$zabbix_web_package = 'zabbix-web'

Expand Down Expand Up @@ -279,26 +261,18 @@
include apache
include apache::mod::dir
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'
} else {
$fpm_service = 'php-fpm'
$fpm_scl_prefix = ''
}
include apache::mod::proxy
include apache::mod::proxy_fcgi
$apache_vhost_custom_fragment = ''

service { $fpm_service:
service { 'php-fpm':
ensure => 'running',
enable => true,
}

file { "/etc${fpm_scl_prefix}/php-fpm.d/zabbix.conf":
file { '/etc/php-fpm.d/zabbix.conf':
ensure => file,
notify => Service[$fpm_service],
notify => Service['php-fpm'],
content => epp('zabbix/web/php-fpm.d.zabbix.conf.epp'),
}

Expand All @@ -311,7 +285,7 @@
'php',
'phar',
],
handler => "proxy:unix:/var${fpm_scl_prefix}/run/php-fpm/zabbix.sock|fcgi://localhost",
handler => 'proxy:unix:/var/run/php-fpm/zabbix.sock|fcgi://localhost',
},
],
}
Expand Down
3 changes: 0 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,20 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7",
"8",
"9"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"7",
"8",
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7",
"9"
]
},
Expand Down
4 changes: 4 additions & 0 deletions spec/acceptance/hieradata/family/RedHat/9.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
postgresql::globals::manage_dnf_module: true
postgresql::globals::manage_package_repo: false
postgresql::globals::version: '15'
8 changes: 1 addition & 7 deletions spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@
end
let(:facts) { facts }

zabbix_version = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
'5.0'
else
'6.0'
end
zabbix_version = '6.0'

case facts[:os]['family']
when 'Gentoo'
Expand All @@ -66,8 +62,6 @@

context 'with all defaults' do
it { is_expected.to contain_selinux__module('zabbix-agent') } if facts[:os]['family'] == 'RedHat'
it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_file(include_dir).with_ensure('directory') }
Expand Down
10 changes: 1 addition & 9 deletions spec/classes/database_postgresql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,7 @@
end

supported_versions.each do |zabbix_version|
path = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
# Path on EL7
if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
'/usr/share/zabbix-sql-scripts/postgresql/'
else
"/usr/share/doc/zabbix-*-pgsql-#{zabbix_version}*/"
end
# Path on Debian and EL8
elsif Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
path = if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
'/usr/share/zabbix-sql-scripts/postgresql/'
else
'/usr/share/doc/zabbix-*-pgsql'
Expand Down
2 changes: 0 additions & 2 deletions spec/classes/javagateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
it { is_expected.to contain_service('zabbix-java-gateway').with_enable('true') }
it { is_expected.to contain_service('zabbix-java-gateway').with_require(['Package[zabbix-java-gateway]', 'File[/etc/zabbix/zabbix_java_gateway.conf]']) }

it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
it { is_expected.to contain_apt__key('zabbix-A1848F5') } if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_apt__key('zabbix-FBABD5F') } if facts[:os]['family'] == 'Debian'
end
Expand Down
6 changes: 1 addition & 5 deletions spec/classes/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
}
end

zabbix_version = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
'5.0'
else
'6.0'
end
zabbix_version = '6.0'

it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf.d').with_ensure('directory') }
it { is_expected.to contain_file('/etc/zabbix/zabbix_proxy.conf.d').with_require('File[/etc/zabbix/zabbix_proxy.conf]') }
Expand Down
85 changes: 45 additions & 40 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,54 +83,59 @@
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl('https://example.com/foo') }
end

case facts[:os]['release']['major']
when '7'
context 'on RedHat 7 and Zabbix 5.0' do
let :params do
{
zabbix_version: '5.0',
manage_repo: true
}
end
major = facts[:os]['release']['major']
context "on RedHat #{major} and Zabbix 5.0" do
let :params do
{
zabbix_version: '5.0',
manage_repo: true
}
end

it { is_expected.to contain_yumrepo('zabbix').with_baseurl('https://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/') }
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl('https://repo.zabbix.com/non-supported/rhel/7/$basearch/') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4') }
it { is_expected.to contain_yumrepo('zabbix-frontend') }
it { is_expected.to contain_yumrepo('zabbix').with_baseurl("https://repo.zabbix.com/zabbix/5.0/rhel/#{major}/$basearch/") }

it { is_expected.to contain_package('zabbix-required-scl-repo').with_ensure('latest').with_name('centos-release-scl') } if facts[:os]['name'] == 'CentOS'
it { is_expected.to contain_package('zabbix-required-scl-repo').with_ensure('latest').with_name('oracle-softwarecollection-release-el7') } if facts[:os]['name'] == 'OracleLinux'
end
when '9'
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591') } if facts[:os]['release']['major'].to_i < 9
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } if facts[:os]['release']['major'].to_i >= 9

context 'on RedHat 9 and Zabbix 5.0' do
let :params do
{
zabbix_version: '5.0',
manage_repo: true
}
end
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl("https://repo.zabbix.com/non-supported/rhel/#{major}/$basearch/") }

it { is_expected.to contain_yumrepo('zabbix').with_baseurl('https://repo.zabbix.com/zabbix/5.0/rhel/9/$basearch/') }
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl('https://repo.zabbix.com/non-supported/rhel/9/$basearch/') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4') } if facts[:os]['release']['major'].to_i < 9
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } if facts[:os]['release']['major'].to_i >= 9
end

context "on RedHat #{major} and Zabbix 6.0" do
let :params do
{
zabbix_version: '6.0',
manage_repo: true
}
end

context 'on RedHat 9 and Zabbix 6.0' do
let :params do
{
zabbix_version: '6.0',
manage_repo: true
}
end
it { is_expected.to contain_yumrepo('zabbix').with_baseurl("https://repo.zabbix.com/zabbix/6.0/rhel/#{major}/$basearch/") }

it { is_expected.to contain_yumrepo('zabbix').with_baseurl('https://repo.zabbix.com/zabbix/6.0/rhel/9/$basearch/') }
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl('https://repo.zabbix.com/non-supported/rhel/9/$basearch/') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') }
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591') } if facts[:os]['release']['major'].to_i < 9
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } if facts[:os]['release']['major'].to_i >= 9

it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl("https://repo.zabbix.com/non-supported/rhel/#{major}/$basearch/") }

it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4') } if facts[:os]['release']['major'].to_i < 9
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } if facts[:os]['release']['major'].to_i >= 9
end

context "on RedHat #{major} and Zabbix 7.0" do
let :params do
{
zabbix_version: '7.0',
manage_repo: true
}
end

it { is_expected.to contain_yumrepo('zabbix').with_baseurl("https://repo.zabbix.com/zabbix/7.0/rhel/#{major}/$basearch/") }
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005') }
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl("https://repo.zabbix.com/non-supported/rhel/#{major}/$basearch/") }

it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005') } if facts[:os]['release']['major'].to_i < 9
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } if facts[:os]['release']['major'].to_i >= 9
end
end
end
Expand Down
9 changes: 1 addition & 8 deletions spec/classes/sender_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
facts
end

zabbix_version = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7'
'5.0'
else
'6.0'
end
zabbix_version = '6.0'

context 'with all defaults' do
it { is_expected.to contain_class('zabbix::sender') }
Expand Down Expand Up @@ -48,9 +44,6 @@
when 'RedHat'
it { is_expected.to contain_yumrepo('zabbix-nonsupported') }
it { is_expected.to contain_yumrepo('zabbix') }

it { is_expected.to contain_yumrepo('zabbix-frontend') } if facts[:os]['release']['major'] == '7'
it { is_expected.to contain_package('zabbix-required-scl-repo') } if facts[:os]['release']['major'] == '7' && %w[OracleLinux CentOS].include?(facts[:os]['name'])
when 'Debian'
it { is_expected.to contain_apt__source('zabbix') }
it { is_expected.to contain_apt__key('zabbix-A1848F5') }
Expand Down
Loading

0 comments on commit feb6014

Please sign in to comment.