Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have been attempting to create a manifest for installing postgres 9.1 using puppet on a Centos 5 server. I have been trying to adapt the instructions at http://wiki.postgresql.org/wiki/YUM_Installation in order to achieve this and when I go through a manual process, I have been able to.

It would seem to me therefore that a puppet manifest containing

package { 'postgresql91-server':
  ensure => installed,
  source => 'http://yum.postgresql.org/9.1/redhat/rhel-5-x86_64/pgdg-centos91-9.1-4.noarch.rpm'
}

however on attempting to apply this manifest I get

err: /Stage[main]//Package[postgresql91-server]/ensure: change from absent to present failed: Could not find package postgresql91-server

Any expert puppeteers out there able to help me?

share|improve this question
1  
Removed postgresql tag - this question applies to any package with dependencies not available in a local repository. +1 for including exact error message text, commands and (some) version numbers. –  Craig Ringer Dec 19 '12 at 1:52

3 Answers 3

up vote 9 down vote accepted

Add the repo to yum (using puppet of course), then specify the repo resource as a dependency of the package. This will make upgrading easier later on. See the puppet docs on yum repos for more info.

share|improve this answer
    
Thanks very much for this –  Mr Wilde Dec 19 '12 at 14:18

Thanks to all help from Steve and Paul. The final code that I have used is

yumrepo { "postgres":
  baseurl => "http://yum.postgesql.org/9.1/redhat/rhel-5x86_64/",
  descr => "Postgres 9.1 repository",
  enabled => 1,
  gpgcheck => 1
}

package { 'postgresql91-server' :
  ensure => installed,
}

This does the trick!

share|improve this answer
    
gpgcheck => 0 isn't the best idea if you can avoid that. Are postgresql really releasing unsigned RPMs in their yumrepo? –  Paul Gear Dec 20 '12 at 6:28
1  
I'll make a change to gpgcheck => 1 as they do sign their rpms. Thanks for the advice –  Mr Wilde Dec 21 '12 at 10:49

According to http://docs.puppetlabs.com/references/stable/type.html#package, source is dependent upon the underlying package provider supporting it. To my knowledge, yum doesn't allow arbitrary URLs - you must specify a repo (as Steve Wills mentioned).

You might be able to work around this by specifying 'provider => "rpm"' for just this package resource, but i've not tried this myself.

share|improve this answer
1  
Yum does allow arbitrary URLs, but it cannot work out that the URL is part of a yum respository and fetch dependencies from the same repository. You can install from a URL to an RPM only if you have a locally defined repo that contains all the dependencies or the dependencies of the package are already installed. –  Craig Ringer Dec 19 '12 at 1:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.