diff --git a/manifests/database/postgresql.pp b/manifests/database/postgresql.pp index a380c71d4..bceb083f9 100644 --- a/manifests/database/postgresql.pp +++ b/manifests/database/postgresql.pp @@ -24,7 +24,7 @@ assert_private() if ($database_schema_path == false) or ($database_schema_path == '') { - if member(['CentOS', 'RedHat', 'OracleLinux', 'VirtuozzoLinux'], $facts['os']['name']) { + if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7' { if versioncmp($zabbix_version, '6.0') >= 0 { $schema_path = '/usr/share/zabbix-sql-scripts/postgresql/' } else { diff --git a/manifests/proxy.pp b/manifests/proxy.pp index ccc385448..f2a6f1913 100644 --- a/manifests/proxy.pp +++ b/manifests/proxy.pp @@ -420,32 +420,11 @@ } } - # Now we are going to install the correct packages. - case $facts['os']['name'] { - 'redhat', 'centos', 'oraclelinux', 'VirtuozzoLinux': { - #There is no zabbix-proxy package in 3.0 - if versioncmp('3.0',$zabbix_version) > 0 { - package { 'zabbix-proxy': - ensure => $zabbix_package_state, - require => Package["zabbix-proxy-${db}"], - tag => 'zabbix', - } - } - - # Installing the packages - package { "zabbix-proxy-${db}": - ensure => $zabbix_package_state, - tag => 'zabbix', - } - } # END 'redhat','centos','oraclelinux' - default : { - # Installing the packages - package { "zabbix-proxy-${db}": - ensure => $zabbix_package_state, - tag => 'zabbix', - } - } # END default - } # END case $facts['os']['name'] + # Installing the packages + package { "zabbix-proxy-${db}": + ensure => $zabbix_package_state, + tag => 'zabbix', + } # Controlling the 'zabbix-proxy' service if $manage_service { diff --git a/manifests/repo.pp b/manifests/repo.pp index 384a6c1a4..b0a176d82 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -70,8 +70,8 @@ priority => '1', } - # Zabbix 5.0 frontend on CentOS 7 has different location. - if ($facts['os']['name'] == 'CentOS' and $majorrelease == '7' and $zabbix_version == '5.0') { + # 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, @@ -87,10 +87,23 @@ } } - if ($facts['os']['name'] == 'CentOS' and $facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) { - package { 'zabbix-required-scl-repo': - ensure => 'latest', - name => 'centos-release-scl', + if ($facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) { + 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, + } } } } diff --git a/manifests/web.pp b/manifests/web.pp index ef29e3b85..8060bea21 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -217,8 +217,8 @@ } } - case $facts['os']['name'] { - 'ubuntu', 'debian': { + case $facts['os']['family'] { + 'Debian': { $zabbix_web_package = 'zabbix-frontend-php' $php_db_package = "php-${db}" @@ -230,7 +230,7 @@ ], } } - 'CentOS', 'RedHat': { + 'RedHat': { $zabbix_web_package = 'zabbix-web' if ($facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5.0') >= 0) { package { "zabbix-web-${db}-scl": @@ -258,7 +258,7 @@ tag => 'zabbix', } } - } # END case $facts['os']['name'] + } # END case $facts['os']['family'] file { '/etc/zabbix/web': ensure => directory, diff --git a/spec/acceptance/server_spec.rb b/spec/acceptance/server_spec.rb index 4d6d9cf8a..59594a225 100644 --- a/spec/acceptance/server_spec.rb +++ b/spec/acceptance/server_spec.rb @@ -19,7 +19,8 @@ class { 'postgresql::globals': encoding => 'UTF-8', locale => 'en_US.UTF-8', - manage_package_repo => true, + manage_package_repo => $facts['os']['release']['major'] != '8', + manage_dnf_module => $facts['os']['release']['major'] == '8', version => '12', } -> class { 'postgresql::server': } diff --git a/spec/acceptance/zabbix_application_spec.rb b/spec/acceptance/zabbix_application_spec.rb index a4a08dc73..19374986a 100644 --- a/spec/acceptance/zabbix_application_spec.rb +++ b/spec/acceptance/zabbix_application_spec.rb @@ -25,7 +25,8 @@ class { 'apache': include apache::mod::php class { 'postgresql::globals': locale => 'en_US.UTF-8', - manage_package_repo => true, + manage_package_repo => $facts['os']['release']['major'] != '8', + manage_dnf_module => $facts['os']['release']['major'] == '8', version => '12', } -> class { 'postgresql::server': } diff --git a/spec/acceptance/zabbix_host_spec.rb b/spec/acceptance/zabbix_host_spec.rb index dc00d810b..2fe3cc632 100644 --- a/spec/acceptance/zabbix_host_spec.rb +++ b/spec/acceptance/zabbix_host_spec.rb @@ -34,7 +34,8 @@ class { 'apache': include apache::mod::php class { 'postgresql::globals': locale => 'en_US.UTF-8', - manage_package_repo => true, + manage_package_repo => $facts['os']['release']['major'] != '8', + manage_dnf_module => $facts['os']['release']['major'] == '8', version => '12', } -> class { 'postgresql::server': } diff --git a/spec/acceptance/zabbix_hostgroup_spec.rb b/spec/acceptance/zabbix_hostgroup_spec.rb index 99fb43575..b380fce03 100644 --- a/spec/acceptance/zabbix_hostgroup_spec.rb +++ b/spec/acceptance/zabbix_hostgroup_spec.rb @@ -18,7 +18,8 @@ class { 'apache': include apache::mod::php class { 'postgresql::globals': locale => 'en_US.UTF-8', - manage_package_repo => true, + manage_package_repo => $facts['os']['release']['major'] != '8', + manage_dnf_module => $facts['os']['release']['major'] == '8', version => '12', } -> class { 'postgresql::server': } diff --git a/spec/acceptance/zabbix_proxy_spec.rb b/spec/acceptance/zabbix_proxy_spec.rb index b7c5da3ba..3c5c11d72 100644 --- a/spec/acceptance/zabbix_proxy_spec.rb +++ b/spec/acceptance/zabbix_proxy_spec.rb @@ -19,7 +19,8 @@ class { 'apache': include apache::mod::php class { 'postgresql::globals': locale => 'en_US.UTF-8', - manage_package_repo => true, + manage_package_repo => $facts['os']['release']['major'] != '8', + manage_dnf_module => $facts['os']['release']['major'] == '8', version => '12', } -> class { 'postgresql::server': } diff --git a/spec/acceptance/zabbix_template_host_spec.rb b/spec/acceptance/zabbix_template_host_spec.rb index 576742c9e..e033f4039 100644 --- a/spec/acceptance/zabbix_template_host_spec.rb +++ b/spec/acceptance/zabbix_template_host_spec.rb @@ -27,7 +27,8 @@ class { 'apache': include apache::mod::php class { 'postgresql::globals': locale => 'en_US.UTF-8', - manage_package_repo => true, + manage_package_repo => $facts['os']['release']['major'] != '8', + manage_dnf_module => $facts['os']['release']['major'] == '8', version => '12', } -> class { 'postgresql::server': } diff --git a/spec/acceptance/zabbix_template_spec.rb b/spec/acceptance/zabbix_template_spec.rb index 2fe4c7991..5f52043b2 100644 --- a/spec/acceptance/zabbix_template_spec.rb +++ b/spec/acceptance/zabbix_template_spec.rb @@ -18,7 +18,8 @@ class { 'apache': include apache::mod::php class { 'postgresql::globals': locale => 'en_US.UTF-8', - manage_package_repo => true, + manage_package_repo => $facts['os']['release']['major'] != '8', + manage_dnf_module => $facts['os']['release']['major'] == '8', version => '12', } -> class { 'postgresql::server': } diff --git a/spec/classes/database_postgresql_spec.rb b/spec/classes/database_postgresql_spec.rb index 808c07b92..975f0fceb 100644 --- a/spec/classes/database_postgresql_spec.rb +++ b/spec/classes/database_postgresql_spec.rb @@ -20,21 +20,18 @@ end supported_versions.each do |zabbix_version| - path = case facts[:os]['name'] - when 'CentOS', 'RedHat', 'OracleLinux', 'VirtuozzoLinux' - # Path on RedHat + 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 + '/usr/share/zabbix-sql-scripts/postgresql/' else - # Path on Debian - if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0 - '/usr/share/zabbix-sql-scripts/postgresql/' - else - '/usr/share/doc/zabbix-*-pgsql' - end + '/usr/share/doc/zabbix-*-pgsql' end sql_server = case zabbix_version diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index 3b1f46ec1..3973ce126 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -85,6 +85,7 @@ it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4') } 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'