2

I'm having some trouble getting postgresql[1] to install with puppet[2] on a blank ubuntu box.

I need to install postgresql 9.3 on Ubuntu 13.10. Since postgresql 9.3 is apparently not in the official repository, I need to add some sort of key (apt-key add )[3].

I'm a developer so I don't often setup such systems from scratch and now I'm having to find the right set of documents for apt, postgresql, puppet and ubuntu. However, this stack is popular enough that it should be pretty common.

Any one have steps I can follow to install pgsql 9.3 on a blank ubuntu 13.10 box (using puppet)? I'm willing to blow away my existing vm and re-install 13.10 on my virtualbox to make sure I have a perfectly standard ubuntu server installation. As long as I can re-produce this setup again and again in a declarative manner, I don't mind things like installing from source, etc (although I prefer binary packages).

[1]https://forge.puppetlabs.com/puppetlabs/postgresql

[2]https://forge.puppetlabs.com/puppetlabs/apt

[3]https://wiki.postgresql.org/wiki/Apt

1

Dunno if it was true when you wrote your question, but the puppetlabs/postgresql module does some pretty clever stuff with versions that are not standard for your OS distro, including installing the required repository.

Snippets from my config:

In one of my puppet classes I call:

    class { 'postgresql::globals':
      encoding => hiera('postgresql::globals::encoding', 'UTF8'),
      locale => hiera('postgresql::globals::locale', 'C'),
      manage_package_repo => hiera('postgresql::globals::manage_package_repo', false),
      version => hiera('postgresql::globals::version', undef),
      notify => Class['postgresql::server', 'postgresql::client'],
    }

and in my hiera config data I have:

postgresql::globals::version: "9.3"
postgresql::globals::manage_package_repo: true

Using hiera like this is optional of course, but it gives you a nice way to use different versions on different hosts. On later versions of puppet (at least 3.x) you can override postgresql::globals variables without needing that to be part of how you call the package.

You won't need to do stuff from source here, but if you did, I'd recommend that you should build your own package rather than try to automate the build process through puppet. Avoid it as far as possible though, since it sets you up to do ongoing maintenance of that package.

|improve this answer|||||
0

Why do you want to install PostgreSQL 9.3 using puppetlabs.

There is already a easy method to install PostgreSQL on Ubuntu:

Just follow the step described here:

http://wiki.postgresql.org/wiki/Apt

|improve this answer|||||
  • 4
    I would like to manage my machine declaratively. Rather than keeping a list of commands somewhere or write a script, may as well do it the puppet way. If for no other reason than just to experiment and learn. – Shahbaz Jan 26 '14 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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