Added support for defining yum repositories.
This commit is contained in:
parent
2223edcd76
commit
0957dcf36d
1 changed files with 52 additions and 0 deletions
|
@ -26,3 +26,55 @@ class yum::updatesd {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Add new yum repository.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $name:
|
||||
# Repository name.
|
||||
# $baseurl:
|
||||
# Base URL for this repository.
|
||||
# $mirrorlist:
|
||||
# Mirrorlist URL for this repository.
|
||||
# $descr:
|
||||
# Repository description. Defaults to $name.
|
||||
# $gpgkey:
|
||||
# Location where GPG signing key can be found. If not set
|
||||
# GPG check will be disabled.
|
||||
#
|
||||
# === Sample usage
|
||||
#
|
||||
# yum::repo { "tmz-puppet":
|
||||
# baseurl => "http://tmz.fedorapeople.org/repo/puppet/epel/5/i386/",
|
||||
# descr => "Puppet for EL 5 - i386",
|
||||
# gpgkey => "http://tmz.fedorapeople.org/repo/RPM-GPG-KEY-tmz",
|
||||
# }
|
||||
#
|
||||
define yum::repo($baseurl="", $mirrorlist="", $descr="", $gpgkey="") {
|
||||
|
||||
tag("bootstrap")
|
||||
|
||||
if !$baseurl and !$mirrorlist {
|
||||
fail("Either \$baseurl or \$mirrorlist needs to be defined for yum::repo")
|
||||
}
|
||||
if $baseurl and $mirrorlist {
|
||||
fail("Cannot set both \$baseurl and \$mirrorlist for yum::repo")
|
||||
}
|
||||
|
||||
if $descr {
|
||||
$descr_real = $descr
|
||||
} else {
|
||||
$descr_real = $name
|
||||
}
|
||||
|
||||
file { "/etc/yum.repos.d/${name}.repo":
|
||||
ensure => present,
|
||||
content => template("yum/yum.repo.erb"),
|
||||
mode => 0644,
|
||||
owner => "root",
|
||||
group => "root",
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue