A less elegant way, but an alternative is to simply have a *.repo file per use case (if you don't have too many) and simply include that file in the class or node that needs it.
On Dec 21, 4:07 am, Felix Frank <felix.fr...@alumni.tu-berlin.de> wrote: > On 12/20/2010 07:26 PM, Matthew Macdonald-Wallace wrote: > > > > > Hi all, > > > I'm wondering how other people mange yum repositories using the yumrepo > > type. > > > At the moment, we have a class called "repos" which has all of our repos > > defined in it. > > > This class is included in our 'base' class which sets up things common > > to all servers such as puppet, mcollective, nrpe etc. > > > The down side of this is that all of our repos are included on all of > > our servers, leading to a complete mess in /etc/yum.repos.d/ > > > I'm now thinking that I need to only call in the various repos for the > > servers which require them, i.e. CentosBase and others would be included > > in the 'base' class, however those which provide things such as php 5.3 > > would only be included on webservers etc. > > > What would be even nicer would be if there was a way to override certain > > aspects of existing repos, for example: > > > class base{ > > # other yumrepo defines... > > ... > > ... > > > # stick with the php 5.1 in Centos Base > > yumrepo{"epel": > > excludepkgs=>"php*", > > } > > > } > > > class webserverphp52 { > > # include php5.2 from epel > > yumrepo{"epel": > > excludepkgs => "", > > } > > } > > Hi, > > I'm not using yum, but this looks like a use case for either or both of > virtual resources and inheritance: > > class yumrepos { # included by each and every node > @yumrepo { > "one": ...; > "two": ...; > ... > "epel": excludepkgs=>"php*", ...; > } > > } > > class base_repos { # also included by all (?) > realize(Yumrepo["foo", "bar"]) > > } > > class php_repos { # only for those who want > realize(Yumrepo["epel"]) > > } > > class yumrepos_epel_enable_php inherits yumrepos { > Yumrepo["epel"] { excludepkgs => "" } > > } > > So your webserver class will probably > include php_repos > include yumrepos_epel_enable_php > to get (in addition to the base repos) epel and include epel's PHP packages. > > HTH, > Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.