Ask Your Question
0

where should i configure yum repos ? In puppet master or puppet Agent?

asked 2015-11-09 11:20:54 -0600

sandeep gravatar image

For the module to be installed in an agent from the master, i came to know that yum repository should be configured so that the module can extract the software packages from yum repos. But my question where should we configure yum?whether in puppet master or puppet Agent? Can someone please explain?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-11-09 18:23:24 -0600

GregLarkin gravatar image

The basic idea behind writing Puppet code is that you are declaring what the final configuration of the agent node shall be. So if you want to configure a yum repository on an agent node, you write some code to do that like so:

yumrepo { 'myrepo':
  baseurl  => "http://local.server.org/myrepo/${::operatingsystem}/${::operatingsystemrelease}/${::architecture}",
  descr    => "My Local Repo",
  enabled  => 1,
  gpgcheck => 0,
}

Recognize the fact that this code is stored on the Puppet master, and it's compiled on the Puppet master into a catalog that's delivered to the Puppet agent running on a server. The Puppet agent processes the catalog, and when it encounters this resource, it will make sure that the yum repository file has been created and has the correct content. You will end up with a file /etc/yum.repos.d/myrepo.repo on your server with content similar to this:

[myrepo]
name=My Local Repo
baseurl=http://local.server.org/myrepo/CentOS/6.6/x86_64
enabled=1
gpgcheck=0

Once that repository has been configured, you can write package resources that will also be enforced on your agent node, and the packages may be downloaded from that new repository.

You'll also likely want to add a dependency so that any yumrepo resource is processed before any package resource. You can do that with one line by adding this to your code:

Yumrepo <| |> -> Package <| |>

Hope that answers your question!

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

Stats

Asked: 2015-11-09 11:20:54 -0600

Seen: 124 times

Last updated: Nov 09 '15