Re: [Puppet Users] Install RPM package via puppet

4,999 views
Skip to first unread message

Jakov Sosic

unread,
Nov 1, 2012, 4:27:29 PM11/1/12
to puppet...@googlegroups.com
On 11/01/2012 08:49 PM, Sixthmoon wrote:
> I am trying to get a package (iftop) installed on a test node using
> puppet but I can't get it to install. This seems like it should be
> simple, but I can't figure out what I am missing. Have done a lot of
> searching for similar problems and the answers I found seem to be vague
> in the details and explanation.
>
> I have the package added to an internal yum repo. OS is Centos 5.4.
> Puppet version is 2.6.2-1. The module is "utilities". This is a working
> production environment. (Person who set it no longer around) As a
> verification item to note, I have added a custom fact to the "utilities"
> module and it correctly being picked up by the test node.
>
> I have added the following to init.pp
>
> class utilities {
>
> package { "iftop":
> ensure => "present",
> source =>
> 'http://yum.repo.internal/misc/iftop-0.17-1.el5.rf.x86_64.rpm'
> }
> }
>
> When I run puppetd --test --debug I see no output regarding iftop in
> the debug output. Any troubleshooting tips or suggestions as to what I
> am missing?

Try to remove doublequotes around present, and try to add provide =>
'rpm' to resource.

Also, don't forget to include utilities in your node's manifest.


--
Jakov Sosic
www.srce.unizg.hr

Gavin Williams

unread,
Nov 1, 2012, 4:34:58 PM11/1/12
to puppet...@googlegroups.com
If you've added it to the relevant yum repo, does it show up when trying to install using yum directly on the node?

My understanding is the source option is only needed for the rpm provider. If you want to use yum, just drop the source and make the resource name the package... Should then install via yum.

Hth.
Gav

Tim Mooney

unread,
Nov 1, 2012, 5:11:57 PM11/1/12
to puppet...@googlegroups.com
In regard to: [Puppet Users] Install RPM package via puppet, Sixthmoon said...:

> I have the package added to an internal yum repo. OS is Centos 5.4. Puppet
> version is 2.6.2-1. The module is "utilities". This is a working production
> environment. (Person who set it no longer around) As a verification item to
> note, I have added a custom fact to the "utilities" module and it correctly
> being picked up by the test node.
>
> I have added the following to init.pp
>
> class utilities {
>
> package { "iftop":
> ensure => "present",
> source =>
> 'http://yum.repo.internal/misc/iftop-0.17-1.el5.rf.x86_64.rpm'
> }
> }

package { 'iftop':
ensure => present,
require => Yumrepo['your-repo-name-here'],
}

You should also have a

yumrepo {'your-repo-name-here':
baseurl => 'http://your.host.here/repo/CentOS/$releasever/$basearch/',
enabled => 1,
descr => 'whatever',
metadata_expire => '300',
}

somewhere in your catalog.

You've already done the parts that a lot of people seem to want to skip;
specifically packaging the software and creating a local repo with the
software in it. You just need to define your repo to puppet and then
use a very standard "package" resource to make it present.

Note the yumrepo resource type supports a lot more attributes, which you
may wish to investigate.

Tim
--
Tim Mooney Tim.M...@ndsu.edu
Enterprise Computing & Infrastructure 701-231-1076 (Voice)
Room 242-J6, IACC Building 701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

Sixthmoon

unread,
Nov 1, 2012, 5:39:28 PM11/1/12
to puppet...@googlegroups.com
Gavin,

Yes, I can do a manual yum install. There are no dependencies. The rpm installs the single binary.

Thanks,

Mike

Sixthmoon

unread,
Nov 1, 2012, 6:28:17 PM11/1/12
to puppet...@googlegroups.com, tim.m...@ndsu.edu
Tim,

It looks like our Puppet master doesn't have yum setup that way. From what I see we are having puppet place the .repo files into /etc/yum.repo.d/

All the current package definitions only have the following attributes:

class example {

    package { [ "example" ]:
              ensure => "present",
              require => [File[ "/etc/yum.repos.d" ], Exec[ "/usr/bin/yum makecache" ]],

Tim Mooney

unread,
Nov 1, 2012, 6:59:24 PM11/1/12
to puppet...@googlegroups.com
In regard to: Re: [Puppet Users] Install RPM package via puppet, Sixthmoon...:

> Tim,
>
> It looks like our Puppet master doesn't have yum setup that way. From what
> I see we are having puppet place the .repo files into /etc/yum.repo.d/
>
> All the current package definitions only have the following attributes:
>
> class example {
>
> package { [ "example" ]:
> ensure => "present",
> require => [File[ "/etc/yum.repos.d" ], Exec[ "/usr/bin/yum
> makecache" ]],
> }
> }

Ok, that should work too, though I generally try avoid exec's if possible.
puppet provides a yumrepo resource type so that's what we're using with
puppet, but what you're doing should also work. It's probably going to
result in a lot of calls to 'yum makecache', but that's your choice.

The important point is that the client system that needs to have the
package installed has a repo definition for the repo that contains the
package.

Someone else already asked this and it's a salient question: if you hop
on the client and type

yum info iftop

does yum respond with information about the package from your repo?

If it does, then using just the "package" resource should be enough to
get it installed. On a CentOS client, you shouldn't need to do anything
with "provider" and you shouldn't need to set "source". If it's in the
repo, the default provider (yum) should find it and install it. If it
doesn't, then something else is going on.

Sixthmoon

unread,
Nov 1, 2012, 7:18:16 PM11/1/12
to puppet...@googlegroups.com, tim.m...@ndsu.edu
Yes, yum info iftop on the test node shows:

Available Packages
Name       : iftop
Arch       : x86_64
Version    : 0.17
Release    : 1.el5.rf
Size       : 46 k
Repo       : misc
Summary    : Display bandwidth usage on an interface
URL        : http://www.ex-parrot.com/~pdw/iftop/
License    : GPL
Description: iftop does for network usage what top(1) does for CPU usage. It listens
           : to network traffic on a named interface and displays a table of current
           : bandwidth usage by pairs of hosts. Handy for answering the question
           : "why is our ADSL link so slow?".

Guess that means something else is going on. Probably a dumb syntax error or something on my part. I'll keep at it and post the solution when I find it. I wonder if creating a manifest.pp file and then running puppet apply manifest.pp will show any extra info? Don't even know if that is a valid troubleshooting step.

Thanks for all the replies everyone. 

Mike
Reply all
Reply to author
Forward
0 new messages