Tuesday, October 2, 2012

Puppet install rpms via http sources

The redhat package manager - rpm has the capability to install packages
from an url. As simple as

rpm -ivh http://example.com/package.rpm

Taking this in consideration we can use this into puppet to install packages
from an url.

Save this text as test.pp

class examplerpm ( $src ) {

  package { 'package':
     provider => 'rpm',
     ensure => installed,
     source => "${examplerpm::rpm}"
 }
}

class { 'examplerpm':
  src => 'https://example.com/package.rpm',
}


Apply the manifest with puppet

puppet apply --debug --no-daemonize test.pp

Voila - the package is installed via puppet->rpm provider.
The key to all this is to specify the provider into the Package section of
examplerpm class. This ensures that rpm will go fetch the source and installs
it.


3 comments:

Angel Abad Cerdeira said...

Hi and thanks for your post! Just pointing out a little typo:

source => "${examplerpm::rpm}"

should be:

source => "${examplerpm::src}"

Unknown said...

Good blog post, thanks for providing this puppet installation procedure.

Best Regards,
DevOps Training in Hyderabad
DevOps Online Training in Hyderabad
DevOps Online Training
DevOps Institutes in Hyderabad
Learn DevOps Online
Best DevOps Training Institute in Hyderabad
Best DevOps Online Training Institute in Hyderabad
Best DevOps Online Training in India
DevOps Institute in Hyderabad
Best DevOps Training
DevOps Training and Certification
learn DevOps
DevOps Institutes in Ameerpet
DevOps Training
DevOps Courses
DevOps Certification Training
CourseIng

sharath said...

Thanks for the information. I am currently installing an rpm package from http source but when I try to update the package with a newer version in the http source, rpm won't update the package. Any insight on this is greatly appreciated.
package { 'packagename':
ensure => 'installed',
provider => 'rpm',
source => $url,
}