7

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?

1
  • 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. Dec 19, 2012 at 1:52

3 Answers 3

9

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.

0
3

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!

2
  • 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, 2012 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, 2012 at 10:49
2

According to https://puppet.com/docs/puppet/latest/types/package.html, 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.

2
  • 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. Dec 19, 2012 at 1:52
  • That is if the RPM is actually in a repo. YUM does not require it to be in a repo, it can even install from a local directory. The problem is Puppet 'assumes' it is part of a repo, even when it isn't!
    – anthony
    Oct 22, 2020 at 23:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .