Ask Your Question

How to handle packages that are required by >1 module

asked 2013-04-09 03:36:41 -0500

jonn gravatar image

How do people handle common packages that might be required by >1 module?

At the moment, I tend to manage packages within classes as and when necessary, but as we pull more and more things into Puppet, we’re increasingly finding that the same package is a requirement for several different classes. Right now we’re working around this as and when necessary, by extracting the package into a parent class, and handling it as a virtual resource:

  class foo::packages {
    @package { "binutils": ensure => installed }

  class foo::bar::packages {
     realize( Package[“binutils”] )

  class foo::baz::packages {
     realize( Package[“binutils”] )

However ... (more)

edit retag flag offensive close merge delete


I found this thread which has some things to say on the topic - it's suggested in here that virtual resources are not the way to go, because collections such ...(more)

jonn gravatar imagejonn ( 2013-04-09 10:01:39 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2013-04-09 11:52:37 -0500

Ancillas gravatar image

updated 2013-04-09 11:59:57 -0500

I take a roles approach, and then create a module for each package. This works for internal modules, but modules being used in the Forge are another matter. Does it make sense for all modules to do a test before adding a Package to the catalog?

if defined(Package['bar']) ...

Otherwise, here's the approach I take for my non-forge modules. I prefer to accept the tight coupling of the modules over the complexity of managing some of Puppet's idiosyncrasies. In this case, Installing a package in a separate module, and then later calling other modules which require that ... (more)

edit flag offensive delete link more


@Ancillas - thanks for this. It does seem to be the least worst option at the moment. I read a post in which someone suggested that simple resources which are defined ...(more)

jonn gravatar imagejonn ( 2013-04-10 13:17:30 -0500 )edit

As long as you don't use parameters, you could use include bar in all of your modules when you need a package, but that breaks a pretty fundamental design ...(more)

Ancillas gravatar imageAncillas ( 2013-04-11 11:07:45 -0500 )edit

answered 2013-04-13 02:02:29 -0500

jonn gravatar image

Just to follow this one up - I found this on the Puppet Armatures github:

ARM-12: A Resource Data Format, and Associated Tooling for Manipulating Data

There's some interesting stuff in here in terms of solving the resource duplication issue, plus an alternative to iteration (which is proposed in another armature).

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-04-09 03:36:41 -0500

Seen: 273 times

Last updated: Apr 13 '13