Specifying a source in puppet doesn't seem to work

Solution 1:

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.

Solution 2:

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!

Solution 3:

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.