Ask Your Question

How can I improve class function using a template or other generic method

asked 2013-07-19 03:59:57 -0600

michael1wright gravatar image

Hi, I have a class function that downloads packages using the package method in puppet.

class package {

  define install( $dependence=File[$dummy_dependence_file])
    package { $name:
        ensure => "installed",
        require => $dependence,

I currently use it in my init.pp like so

# install dependencies
$dependence_list = ['glibc.i686','wget','gcc']
# ==Actions
# Install glibc, gcc, wget dependency for running sybase
# ==Requires
# * http proxy to be setup to get around jpm proxy
package::install { $dependence_list:
      dependence => File[ $http_setup_name ],

I would like this method to be more generic. Is it possible instead of using a array of dependencies, which I need to edit the init.pp each time ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-07-19 11:23:27 -0600

lavaman gravatar image

If you are using a sane package manager (yum/apt/etc.), it will resolve those dependencies for you. There is no need to explicitly specify them. Require in puppet is for dependencies between puppet resources and the order they need to execute. In this case, it does not appear that the order of package install would matter. Just install the packages you need and let the package manager figure it out.

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

1 follower


Asked: 2013-07-19 03:59:57 -0600

Seen: 115 times

Last updated: Jul 19 '13