Ask Your Question

Package Install

asked 2015-04-10 11:53:10 -0600

cfgpupp gravatar image


Puppet newbie here so forgive me for some basic question.

I'm looking for a puppet setup to install a package across all servers who have the yum repository defined. After reading online, I came to know that utils module could be used but not sure how to set it up.

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-10 21:43:45 -0600

GregLarkin gravatar image

You can write a Puppet class like so and install it on your master. Once the various agent nodes check in to the master, if they are classified with your class, they will install the package. Are you trying to do something more complex than that?

Example package resource:

# This class lives in <modulesdir>/example/manifests/init.pp
class example {
  package { 'httpd':
    ensure => present,

Alternately, you could install the puppetlabs-stdlib module, then call the ensure_packages function in your class like so:

# This class lives in <modulesdir>/example/manifests/init.pp
class example {
  $packagelist = [ 'httpd', 'bash', 'mysql', 'mysql-server' ]


Hope that helps, and please post back here with any further questions.

edit flag offensive delete link more


but how to send the files or setup to agent machine? first we have to send the the setup and then we are using this packages. So how we can do this?

akshay gravatar imageakshay ( 2015-04-15 01:16:53 -0600 )edit

Yes it did help. Many Thanks!

cfgpupp gravatar imagecfgpupp ( 2015-04-15 20:49:01 -0600 )edit

akshay: the Puppet master only compiles a catalog to instruct the agent what to enforce, i.e. what packages to install. Once the agent receives the catalog, it runs standard commands (yum, rpm, etc.) to install the packages from a repository. They are not delivered from the master to the agent node.

GregLarkin gravatar imageGregLarkin ( 2015-04-15 21:19:25 -0600 )edit

Thank you so much greg. but we are deliver the packages on agent side by using the source attribute. So is there another way?

akshay gravatar imageakshay ( 2015-04-16 00:37:27 -0600 )edit

akshay, write your package resource so that the *agent* can locate the package (.rpm, .deb, etc.) correctly. In the example above, if that code ran on a RHEL 6 machine, the httpd package is downloaded from a remote yum repository by the *agent*. The master does not usually store the packages.

GregLarkin gravatar imageGregLarkin ( 2015-04-16 09:21:27 -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


Asked: 2015-04-10 11:53:10 -0600

Seen: 1,866 times

Last updated: Apr 10 '15