solution: excluding packages via yum

1,068 views
Skip to first unread message

Tim Harper

unread,
Dec 30, 2008, 2:26:18 PM12/30/08
to puppet...@googlegroups.com
Here's a breadcrumb for someone who runs into this themselves.

I ran into an issue where I had the mysql-percona rpm's in a yum repository, so yum was selecting MySQL-percona-devel when told to install mysql-devel.  I needed to pass the -x parameter to yum to get around it.

I created a module to extend yum and give me the option to pass custom parameters:

# /etc/puppet/modules/package_plus_plugins/puppet/provider/package/yum_plus.rb
Puppet::Type.type(:package).provide :yum_plus, :parent => :yum, :source => :rpm do
    desc "Support via ``yum``."

    commands :yum_plus => "yum"

    def yum(*args)
      yum_plus(*args + @resource[:vendor].split(" "))
    end
 end

# then, in my manifest:
package { ["mysql", "mysql-devel"]: ensure => present, provider => yum_plus, vendor => "-x *percona*" }

Criticisms / peer review welcome.

Tim

gary

unread,
Dec 30, 2008, 10:06:15 PM12/30/08
to Puppet Users
Hello Tim,

Yum also supports specifying priorities and exclusions per repo. :)
The puppet yum repo type also lets you configure these settings.

Gary

Tim Harper

unread,
Dec 31, 2008, 12:11:12 PM12/31/08
to puppet...@googlegroups.com
Hi Gary,

That sounds fantastic.  I was looking for such a thing - where can I find it?

Tim

gary

unread,
Dec 31, 2008, 2:51:14 PM12/31/08
to Puppet Users
Hello Tim,

You can specify a repo like this:

[mysql-percona]
...
enabled=1
priority=20
exclude=mysql-devel,...

http://wiki.centos.org/PackageManagement/Yum/ProtectBase
http://wiki.centos.org/PackageManagement/Yum/Priorities

I have the CentOS repos mostly set at priority 1 and then EPEL at a
lower value. If you set the Red Hat/CentOS repo priority to 1 and then
rest to a lower value, I think packages of the same name will never
get installed from lower priority repos. You may just want exclude
instead.

The yumrepo native type also lets you specify priorty or exclusions:

yumrepo { 'percona':
baseurl => "...",
enabled => 1,
exclude => "mysql-devel,...",
priority => ...,
...
}

I just started using immerda's great yum module:

https://git.puppet.immerda.ch/

Manging yum repos in puppet let's you then specify package repo
requirements:

package{ 'package': ensure => enabled, require => Yumrepo['epel'] }

Gary

On Jan 1, 1:11 am, "Tim Harper" <timchar...@gmail.com> wrote:
> Hi Gary,
> That sounds fantastic.  I was looking for such a thing - where can I find
> it?
>
> Tim
>

Tim Harper

unread,
Dec 31, 2008, 3:04:58 PM12/31/08
to puppet...@googlegroups.com
OK, I misunderstood you, I interpreted you were saying there was a
puppet "yum" type (as in an enhanced version of the package type).

Still, this is a great approach and solves the issue. Thank you very much.

Tim

Arnau Bria

unread,
Jan 7, 2009, 11:06:15 AM1/7/09
to puppet...@googlegroups.com
Hi all,

sorry for breaking the threat, I don't know where the OP is.

anyway, Tim Harper provided yum_plus in order to be able to pass args
to yum, in his example, -x option.

http://groups.google.com/group/puppet-users/browse_thread/thread/234e84e569a40f61?hl=en#

I was looking for something similar cause I'd like to pass groupinstall
option. Now I'm doing it with exec type, but it could be better using
yum/yum_plus types for thing that (grepping logs).

Is puppet planning to support yum args, or Tim's aproach is the best
solution?


TIA,
Arnau

Jeffrey Hulten

unread,
Jan 7, 2009, 2:14:52 PM1/7/09
to puppet...@googlegroups.com
For my money the best solution is to use Puppet to manage the yum.conf
files and put your excludes there... But that is me.
Reply all
Reply to author
Forward
0 new messages