Managing RPM Repositories

744 views
Skip to first unread message

Matt Wallace

unread,
Jun 2, 2010, 10:11:57 AM6/2/10
to puppet...@googlegroups.com
Hi all,

I'm trying to write a module to manage yum repositories but before I
re-invent the wheel I was wondering if anyone out there had existing
code I could adapt!

I've looked on Puppet Forge but the only two package management modules
out there appear to be for APT/Deb repos.

Can anyone help?

Kind regards,

Matt

Patrick

unread,
Jun 2, 2010, 1:42:34 PM6/2/10
to puppet...@googlegroups.com

On Jun 2, 2010, at 7:11 AM, Matt Wallace wrote:

> Hi all,
>
> I'm trying to write a module to manage yum repositories but before I
> re-invent the wheel I was wondering if anyone out there had existing
> code I could adapt!

I think there was a resource type built into puppet called yumrepos on the types page. I don't know if it was just removed from the documentation during the port, or actually removed from puppet though.

Patrick

unread,
Jun 2, 2010, 1:45:39 PM6/2/10
to puppet...@googlegroups.com
I found it at http://docs.puppetlabs.com/references/stable/type.html#yumrepo .  For some reason I just didn't see it before.

Matthew Macdonald-Wallace

unread,
Jun 2, 2010, 4:08:31 PM6/2/10
to puppet...@googlegroups.com

Awesome, thanks for that!

I've got it working on a stand-alone manifest with puppet, however the
following manifest doesn't appear to work when placed into a puppet
manifest on the server:

============================================

yumrepo{ atrpms-stable:
name => "atrpms",
baseurl => "http://dl.atrpms.net/el\$releasever-\
$basearch/atrpms/stable",
descr => "atrpms for exim etc",
enabled => "1",
includepkgs => "exim-* dovecot* libspf2*",
gpgkey => "http://atrpms.net/RPM-GPG-KEY.atrpms",
gpgcheck => "1"
}

==========================================

I'm trying to setup a scenario similar to the following:

site-module
|
|---repository modules
| |
| |---atrpms
|
|---email-server
|
|---package{exim:ensure=>installed}

The version of exim I want to install is in atrpms, however I want to be
able to use this repo for other things (I'm also using Dovecot from this
repo in another module) without getting a conflict because the repo has
already been defined elsewhere!

Thanks in advance,

Matt

Patrick

unread,
Jun 2, 2010, 6:16:26 PM6/2/10
to puppet...@googlegroups.com

Sorry, but you might have lost me. Are you saying that you're having problems because when you define the repository in two places it throws an error?

Matt Wallace

unread,
Jun 3, 2010, 4:00:29 AM6/3/10
to puppet...@googlegroups.com
On Wed, 2010-06-02 at 15:16 -0700, Patrick wrote:
> Sorry, but you might have lost me. Are you saying that you're having problems because when you define the repository in two places it throws an error?
>

Not quite! :)

I want to define all my repos in one module and then include the repos
based upon the node class.

For example:

=================================

class webserver {

yumrepo{["atrpms-stable","atrpms-testing","epel","centos-base"]}

# install webserver stuff
...
#finish

}

class mailserver {

yumrepo{['"centos-base","epel","elff"]}

# do mailserver install
...
# finish mailserver install

}
=================================

and then in my repos module:

=================================

yumrepo{ atrpms-stable:
name => "atrpms",
baseurl => "http://dl.atrpms.net/el\$releasever-\
$basearch/atrpms/stable",
descr => "atrpms for exim etc",
enabled => "1",

includepkgs => "exim-* dovecot* libspf2* libsrs*",


gpgkey => "http://atrpms.net/RPM-GPG-KEY.atrpms",
gpgcheck => "1"
}


yumrepo{ atrpms-testing:
name => "atrpms-testing",

$basearch/atrpms/testing",


descr => "atrpms for exim etc",
enabled => "1",

includepkgs => "exim-* dovecot* libspf* libsrs*",


gpgkey => "http://atrpms.net/RPM-GPG-KEY.atrpms",
gpgcheck => "1"
}

===================================

So I only get the minimal repos needed for each node class.

At the moment I can include all the repos or none of the repos and I'd
like to bemore subtle about it without having to redefine each repo for
each class it is used in.

If there's a more appropriate/better way of achieving this, please let
me know!

Kind regards,

Matt

Daniel Pittman

unread,
Jun 3, 2010, 4:22:49 AM6/3/10
to puppet...@googlegroups.com
Matt Wallace <li...@truthisfreedom.org.uk> writes:
> On Wed, 2010-06-02 at 15:16 -0700, Patrick wrote:
>
>> Sorry, but you might have lost me. Are you saying that you're having
>> problems because when you define the repository in two places it throws an
>> error?
>
> Not quite! :)
>
> I want to define all my repos in one module and then include the repos
> based upon the node class.
>
> For example:
>
> =================================
>
> class webserver {
> yumrepo{["atrpms-stable","atrpms-testing","epel","centos-base"]}

include repo::atrpms-stable
include repo::epel

[...]

[...]

> and then in my repos module:
> =================================
>

class repo::atrpms-stable {
> yumrepo{ atrpms-stable:
}

[...]

> So I only get the minimal repos needed for each node class.

...but from experience I wouldn't recommend doing this. You are almost
certainly going to be better off having the same set of repositories on every
server, and using some other mechanism to control which packages or updates
are applied to your systems.

Regards,
Daniel

--
✣ Daniel Pittman ✉ dan...@rimspace.net+61 401 155 707
♽ made with 100 percent post-consumer electrons

Matt Wallace

unread,
Jun 3, 2010, 5:53:53 AM6/3/10
to puppet...@googlegroups.com
On Thu, 2010-06-03 at 18:22 +1000, Daniel Pittman wrote:

> ...but from experience I wouldn't recommend doing this. You are almost
> certainly going to be better off having the same set of repositories on every
> server, and using some other mechanism to control which packages or updates
> are applied to your systems.

Ok, that makes sense.

I've updated my manifests to reflect the above, however now when I run
Yum manually on the servers I get the following output:

Repository 'epel' is missing name in configuration, using id


It doesn't make a difference to the install, I'm just wondering if I'm
missing a flag from the following:

yumrepo{epel:
name => "Epel",
baseurl=> "http://updates.the.namesco.net/centos\$releasever-\
$basearch/RPMS.epel/",
gpgcheck=> "1",
gpgkey=> "http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL",
enabled=> "1",
includepkgs=> "puppet* ruby* facter augeas-libs ruby-augeas ruby-shadow
munin-common munin-node munin-server pyparsing libvirt* libyaml* PyYAML*
cobbler* Django* python-netaddr",
}


Thanks in advance,

Matt

Todd Zullinger

unread,
Jun 4, 2010, 5:21:17 PM6/4/10
to puppet...@googlegroups.com
Matt Wallace wrote:
> I've updated my manifests to reflect the above, however now when I run
> Yum manually on the servers I get the following output:
>
> Repository 'epel' is missing name in configuration, using id
>
>
> It doesn't make a difference to the install, I'm just wondering if I'm
> missing a flag from the following:
>
> yumrepo{epel:
> name => "Epel",
> baseurl=> "http://updates.the.namesco.net/centos\$releasever-\
> $basearch/RPMS.epel/",
> gpgcheck=> "1",
> gpgkey=> "http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL",
> enabled=> "1",
> includepkgs=> "puppet* ruby* facter augeas-libs ruby-augeas ruby-shadow
> munin-common munin-node munin-server pyparsing libvirt* libyaml* PyYAML*
> cobbler* Django* python-netaddr",
> }

You should set the descr parameter. From the yumrepo docs:

descr

A human readable description of the repository. This corresponds
to the name parameter in yum.conf(5). Set this to ‘absent’ to
remove it from the file completely Valid values are absent. Values
can match /.*/.

So rather than name => "Epel", use descr => "Epel" and should be be
good. (Though a pedant would tell you to spell it as EPEL. ;)

--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fleas can be taught nearly anything that a Congressman can.
-- Mark Twain

Reply all
Reply to author
Forward
0 new messages