Skip to content

Commit

Permalink
Merge pull request #126 from bastelfreak/feature-PSBM
Browse files Browse the repository at this point in the history
refactoring of repo.pp
  • Loading branch information
dj-wasabi committed Oct 6, 2015
2 parents 976d890 + 8abcfe6 commit 5e6e339
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 91 deletions.
120 changes: 30 additions & 90 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#
# === Authors
#
# Author Name: ikben@werner-dijkerman.nl
# Author Name:
# ikben@werner-dijkerman.nl
# Tim Meusel <tim@bastelfreak.de>
#
# === Copyright
#
Expand All @@ -29,132 +31,70 @@
) inherits zabbix::params {

if ($manage_repo) {
# Figuring out which major release we have. Or which release name
# for debian/ununtu releases.
case $::operatingsystemrelease {
/^14.04/: {
$majorrelease = '14'
$ubuntu = 'trusty'
}
/^12.04/: {
$majorrelease = '12'
$ubuntu = 'precise'
}
/^10.04/: {
$majorrelease = '10'
$ubuntu = 'lucid'
}
/^8.*/: {
$majorrelease = '8'
$debian = 'jessie'
}
/^7.*/: {
$majorrelease = '7'
$debian = 'wheezy'
}
/^6.*/: {
case $::operatingsystem {
'PSBM': {
$majorrelease = '6'
$debian = 'squeeze'
$reponame = $majorrelease
}
/^5.*/: {
$majorrelease = '5'
$debian = 'lenny'
default: {
$majorrelease = '$releasever'
$reponame = $::operatingsystemmajrelease
}
# Debian unstable releases look something like "jessie/sid"
# In this case, just use the first bit as the version
}
case $::operatingsystemrelease {
/\/sid$/: {
# Zabbix repo doesn't yet support jessie, use wheezy instead
if ($::operatingsystemrelease == 'jessie/sid') {
$debian = 'wheezy'
} else {
$debian = regsubst($::operatingsystemrelease, '/sid$', '')
}
}
# Amazon Linux using epel 6
/^20??.??/: {
$majorrelease = '6'
$releasename = regsubst($::operatingsystemrelease, '/sid$', '')
}
default: {
fail("This is an unsupported operating system (${::operatingsystem} ${::operatingsystemrelease})")
$releasename = $::lsbdistcodename
}
}

case $::operatingsystem {
'centos','scientific','redhat','oraclelinux','amazon','CloudLinux' : {
case $::osfamily {
'RedHat' : {
yumrepo { 'zabbix':
name => "Zabbix_${majorrelease}_${::architecture}",
descr => "Zabbix_${majorrelease}_${::architecture}",
baseurl => "http://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/${::architecture}/",
name => "Zabbix_${reponame}_${::architecture}",
descr => "Zabbix_${reponame}_${::architecture}",
baseurl => "http://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/\$basearch/",
gpgcheck => '1',
gpgkey => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
priority => '1',
}
yumrepo { 'zabbix-nonsupported':
name => "Zabbix_nonsupported_${majorrelease}_${::architecture}",
descr => "Zabbix_nonsupported_${majorrelease}_${::architecture}",
baseurl => "http://repo.zabbix.com/non-supported/rhel/${majorrelease}/${::architecture}/",
name => "Zabbix_nonsupported_${reponame}_${::architecture}",
descr => "Zabbix_nonsupported_${reponame}_${::architecture}",
baseurl => "http://repo.zabbix.com/non-supported/rhel/${majorrelease}/\$basearch/",
gpgcheck => '1',
gpgkey => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
priority => '1',
}

} # END 'centos','redhat','oraclelinux'
'XenServer' : {
yumrepo { 'zabbix':
name => "Zabbix_${majorrelease}_${::architecture}",
descr => "Zabbix_${majorrelease}_${::architecture}",
baseurl => "http://repo.zabbix.com/zabbix/${zabbix_version}/rhel/5/${::architecture}/",
gpgcheck => '1',
gpgkey => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
priority => '1',
}
yumrepo { 'zabbix-nonsupported':
name => "Zabbix_nonsupported_${majorrelease}_${::architecture}",
descr => "Zabbix_nonsupported_${majorrelease}_${::architecture}",
baseurl => "http://repo.zabbix.com/non-supported/rhel/5/${::architecture}/",
gpgcheck => '1',
gpgkey => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
priority => '1',
}

} # END 'XenServer'
'debian' : {
}
'Debian' : {
if ($::architecture == 'armv6l') {
apt::source { 'zabbix':
location => 'http://naizvoru.com/raspbian/zabbix',
release => $debian,
repos => 'main',
key => {
'id' => 'BC274A7EA7FD5DD267C9A18FD54A213C80E871A7',
'source' => 'http://naizvoru.com/raspbian/zabbix/conf/boris@steki.net.gpg.key'
'source' => 'http://naizvoru.com/raspbian/zabbix/conf/boris@steki.net.gpg.key',
},
include => {
'src' => false,
}
},
}
} else {
$operatingsystem = downcase($::operatingsystem)
apt::source { 'zabbix':
location => "http://repo.zabbix.com/zabbix/${zabbix_version}/debian/",
release => $debian,
location => "http://repo.zabbix.com/zabbix/${zabbix_version}/${operatingsystem}/",
repos => 'main',
release => $releasename,
key => {
'id' => 'FBABD5FB20255ECAB22EE194D13D58E479EA5ED4',
'source' => 'http://repo.zabbix.com/zabbix-official-repo.key'
'source' => 'http://repo.zabbix.com/zabbix-official-repo.key',
},
}
}
} # END 'debian'
'ubuntu' : {
apt::source { 'zabbix':
location => "http://repo.zabbix.com/zabbix/${zabbix_version}/ubuntu/",
release => $ubuntu,
repos => 'main',
key => {
'id' => 'FBABD5FB20255ECAB22EE194D13D58E479EA5ED4',
'source' => 'http://repo.zabbix.com/zabbix-official-repo.key'
},
}
} # END 'ubuntu'
}
default : {
fail('Unrecognized operating system for webserver')
}
Expand Down
4 changes: 3 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
{ "operatingsystem":"OracleLinux", "operatingsystemrelease": [ "5.0", "6.0", "7.0" ] },
{ "operatingsystem":"Scientific", "operatingsystemrelease": [ "5.0", "6.0", "7.0" ] },
{ "operatingsystem":"CentOS", "operatingsystemrelease": [ "5.0", "6.0", "7.0" ] },
{ "operatingsystem":"CloudLinux", "operatingsystemrelease": [ "5.0", "6.0", "7.0" ] },
{ "operatingsystem":"XenServer", "operatingsystemrelease": [ "6.0"] },
{ "operatingsystem":"Ubuntu", "operatingsystemrelease": [ "12.04", "14.04" ] },
{ "operatingsystem":"Debian", "operatingsystemrelease": [ "6.0", "7.0", "8.0" ] },
{ "operatingsystem":"CloudLinux", "operatingsystemrelease": [ "6.0", "7.0" ] }
{ "operatingsystem":"PSBM", "operatingsystemrelease": [ "5.0" ] },
{ "operatingsystem":"PCS", "operatingsystemrelease": [ "6.0" ] }
]
}

0 comments on commit 5e6e339

Please sign in to comment.