Ask Your Question
0

How To Affect Resource Type Declared In Another Puppet Module

asked 2016-12-08 21:05:10 -0600

Red Cricket gravatar image

updated 2016-12-09 02:27:50 -0600

I include the class nova::compute::libvirt and this class defines a Package resource like so:

package { 'libvirt-nwfilter':
  ensure => present,
  name   => $::nova::params::libvirt_nwfilter_package_name,
  before => Service['libvirt'],
  tag    => ['openstack', 'nova-support-package'],
}

The problem is that the RPM is in a YUM repo that is not enabled enabled=0. I could solve this issue by changing nova::conpute::libvirt so that Package resource looked like this:

package { 'libvirt-nwfilter':
  ensure => present,
  name   => $::nova::params::libvirt_nwfilter_package_name,
  before => Service['libvirt'],
  tag    => ['openstack', 'nova-support-package'],
  install_options => ['--enablerepo', 'redhat_updates'],
}

But I'd like to not have to modified a module I got from puppet forge because the next time someone else setups up a puppet master they might forget to make the modification. Is there something I can do from the class that includes nova::compute::libvirt?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-12-09 05:28:36 -0600

yo61 gravatar image

The right way to do this is to use a yumrepo resource to enable the repo, something like this:

yumrepo { 'redhat_updates':
  enabled  => 1,
  descr    => 'Redhat Updates',
  baseurl  => 'https://repo.example.org/path',
  gpgcheck => 0,
}

# make sure the repo is created before the libvirt class
Yumrepo [ 'redhat_updates' ] ->
Class [ 'nova::compute::libvirt' ]

Obviously, adjust the params you use for the yumrepo to match what is already in the repo file.

edit flag offensive delete link more

Comments

What if I only want redhat_updates to be enabled when installing RPMs from redhat_updates?

Red Cricket gravatar imageRed Cricket ( 2016-12-09 09:58:19 -0600 )edit

I don't understand your use-case - can you clarify?

yo61 gravatar imageyo61 ( 2016-12-09 10:37:09 -0600 )edit
Red Cricket gravatar imageRed Cricket ( 2016-12-10 00:12:55 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-08 21:05:10 -0600

Seen: 39 times

Last updated: Dec 09 '16