Puppet Class: zabbix::repo
- Inherits:
- zabbix::params
- Defined in:
- manifests/repo.pp
Overview
Class: zabbix::repo
If enabled, this will install the repository used for installing zabbix
Please note:
This class will be called from zabbix::server, zabbix::proxy and
zabbix::agent. No need for calling this class manually.
Parameters
- manage_repo
-
When true, it will create repository for installing the server.
- zabbix_version
-
This is the zabbix version.
- repo_location
-
A custom repo location (e.g. your own mirror)
- unsupported_repo_location
-
A custom repo location for unsupported content (e.g. your own mirror) Currently only supported under RedHat based systems.
Authors
Author Name:
ikben@werner-dijkerman.nl
Tim Meusel <tim@bastelfreak.de>
Copyright
Copyright 2014 Werner Dijkerman
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 |
# File 'manifests/repo.pp', line 34
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] $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'
}
'oraclelinux' : {
$majorrelease = $facts['os']['release']['major']
}
default : {
$majorrelease = $facts['os']['release']['major']
}
}
case $facts['os']['family'] {
'RedHat' : {
# Zabbix-3.2 and newer RPMs are signed with the GPG key
if versioncmp($zabbix_version, '3.2') < 0 {
$gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX'
$gpgkey_nonsupported = $gpgkey_zabbix
}
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',
}
}
'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']['architecture'] == 'armv6l') {
$_repo_location = $repo_location ? {
undef => 'http://naizvoru.com/raspbian/zabbix',
default => $repo_location,
}
apt::source { 'zabbix':
location => $_repo_location,
repos => 'main',
key => {
'id' => 'BC274A7EA7FD5DD267C9A18FD54A213C80E871A7',
'source' => 'https://naizvoru.com/raspbian/zabbix/conf/boris@steki.net.gpg.key',
}
,
include => {
'src' => false,
}
,
}
} else {
$operatingsystem = downcase($facts['os']['name'])
case $facts['os']['release']['full'] {
/\/sid$/ : { $releasename = regsubst($facts['os']['release']['full'], '/sid$', '') }
default : { $releasename = $facts['lsbdistcodename'] }
}
$_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',
}
apt::source { 'zabbix':
location => $_repo_location,
repos => 'main',
release => $releasename,
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)
}
|