Ask Your Question

Why can't I install a Yum repository from RPM and then enable it?

asked 2013-11-12 11:00:30 -0500

binford2k gravatar image

Given a manifest like this, where I install a Yum repository RPM and then enable it with a yumrepo resource, I'd expect it to end up with a usable package repository.

package { 'epel-release':
  provider => rpm,  
  source   => '',
  ensure   => installed,
yumrepo { 'epel':
  enabled     => 1,
  includepkgs => 'python-virtualenv python-pip', # others can conflict with asterisk

Instead, the final result is a Yum repo file that looks like

# cat /etc/yum.repos.d/epel.repo
includepkgs=python-virtualenv python-pip

Obviously, that's not what I want. How can I make it work ... (more)

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2013-11-12 11:12:34 -0500

binford2k gravatar image

updated 2013-11-12 11:23:46 -0500

This is a classic example of trying to manage a single resource with multiple definitions. Remember that Puppet isn't a scripting language, it's a state modeling language. Instead of thinking of it in steps of (1) install repository; (2) manipulate repository, you should instead just describe the state that you want that resource to be in.

To achieve that in a simple and easy way, you could install the RPM on a representative system, then use Puppet itself to generate the resource declaration you'd need to recreate it. Here is an example of that.

[root@monkey ~]# rpm ...
edit flag offensive delete link more

answered 2014-11-16 09:45:36 -0500

nvpuppet gravatar image

For the specific repo in the example, there is a very nice Forge module, stahnma/epel, which will take care of this for you.

Generally, you should be able to pass parameters to the Yumrepo type which will make the Package resource declaration unnecessary and thus avoid your current conundrum.

edit flag offensive delete link more

answered 2014-11-14 17:18:43 -0500

UBPClaw gravatar image

On my Dell physical servers I use wget to download and execute the rpm to enable their repo and install OMSA. Heres my code block. You should be able to do something very similar to enable the EPEL repo

if $manufacturer =~ /Dell/ {
exec { 'omsa_install' :
  path         => '/bin:/usr/bin:/usr/sbin:/sbin',
  command      => 'wget -q -O - $omsa_url | bash',
  creates      => '/etc/yum.repos.d/dell-omsa-repository.repo',
  before       => Package [ "srvadmin-all" ]
package { 'srvadmin-all' : }
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-11-12 11:00:30 -0500

Seen: 1,221 times

Last updated: Nov 16 '14