Puppet Class: zabbix::repo
- Inherits:
- zabbix::params
- Defined in:
- manifests/repo.pp
Summary
If enabled, this will install the repository used for installing zabbixOverview
[View source]
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 |
# File 'manifests/repo.pp', line 12
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 {
if $manage_repo {
case $facts['os']['name'] {
'PSBM': {
$majorrelease = '6'
}
'Amazon': {
$majorrelease = '6'
}
default: {
$majorrelease = $facts['os']['release']['major']
}
}
case $facts['os']['family'] {
'RedHat': {
if 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'
} else {
$gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591'
$gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4'
}
$_repo_location = $repo_location ? {
undef => "https://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/\$basearch/",
default => $repo_location,
}
yumrepo { 'zabbix':
name => "Zabbix_${majorrelease}_${facts['os']['architecture']}",
descr => "Zabbix_${majorrelease}_${facts['os']['architecture']}",
baseurl => $_repo_location,
gpgcheck => '1',
gpgkey => $gpgkey_zabbix,
priority => '1',
}
$_unsupported_repo_location = $unsupported_repo_location ? {
undef => "https://repo.zabbix.com/non-supported/rhel/${majorrelease}/\$basearch/",
default => $unsupported_repo_location,
}
yumrepo { 'zabbix-nonsupported':
name => "Zabbix_nonsupported_${majorrelease}_${facts['os']['architecture']}",
descr => "Zabbix_nonsupported_${majorrelease}_${facts['os']['architecture']}",
baseurl => $_unsupported_repo_location,
gpgcheck => '1',
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) {
# We would like to provide the repos with https urls instead of http
# this requires the apt-transport-https package, but we don't want to manage
# that package here. That should be handled in a profile :(
# somebody should implement https here but make it optional
include apt
}
if ($facts['os']['distro']['id'] == 'Raspbian') {
$operatingsystem = 'raspbian'
} elsif ($facts['os']['architecture'] in ['arm64', 'aarch64']) {
# arm64 is the Debian name, but some facter versions report aarch64 instead
$operatingsystem = "${downcase($facts['os']['name'])}-arm64"
} else {
$operatingsystem = downcase($facts['os']['name'])
}
case $facts['os']['release']['full'] {
/\/sid$/: { $releasename = regsubst($facts['os']['release']['full'], '/sid$', '') }
default: { $releasename = $facts['os']['distro']['codename'] }
}
$_repo_location = $repo_location ? {
undef => "http://repo.zabbix.com/zabbix/${zabbix_version}/${operatingsystem}/",
default => $repo_location,
}
apt::key { 'zabbix-FBABD5F':
id => 'FBABD5FB20255ECAB22EE194D13D58E479EA5ED4',
source => 'https://repo.zabbix.com/zabbix-official-repo.key',
}
apt::key { 'zabbix-A1848F5':
id => 'A1848F5352D022B9471D83D0082AB56BA14FE591',
source => 'https://repo.zabbix.com/zabbix-official-repo.key',
}
# Debian 11 provides Zabbix 5.0 by default. This can cause problems for 4.0 versions
$pinpriority = $facts['os']['release']['major'] ? {
'11' => 1000,
default => undef,
}
apt::source { 'zabbix':
location => $_repo_location,
repos => 'main',
release => $releasename,
pin => $pinpriority,
require => [
Apt_key['zabbix-FBABD5F'],
Apt_key['zabbix-A1848F5'],
],
}
Apt::Source['zabbix'] -> Package<|tag == 'zabbix'|>
Class['Apt::Update'] -> Package<|tag == 'zabbix'|>
}
default: {
fail("Managing a repo on ${facts['os']['family']} is currently not implemented")
}
}
} # end if ($manage_repo)
}
|