Skip to content

Instantly share code, notes, and snippets.

@bradmontgomery
Created February 10, 2012 22:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradmontgomery/1793609 to your computer and use it in GitHub Desktop.
Save bradmontgomery/1793609 to your computer and use it in GitHub Desktop.
To install PostgresSQL 9.1 on Ubuntu 10.04 with Chef
# mycookbook/recipes/apt_postgresql_ppa.rb
#
# This recipe should add the sources for
# PostgreSQL 9.1 using the PPA available at:
# https://launchpad.net/~pitti/+archive/postgresql
apt_repository "postgresql" do
uri "http://ppa.launchpad.net/pitti/postgresql/ubuntu"
distribution node['lsb']['codename']
components ["main"]
keyserver "keyserver.ubuntu.com"
key "8683D8A2"
action :add
notifies :run, resources(:execute => "apt-get update"), :immediately
end
# roles/pg_server.rb
name "pg_server"
description "a PostgreSQL server"
run_list(
"recipe[mycookbook::apt_postgresql_ppa]",
"recipe[postgresql::server]",
"recipe[database]",
)
override_attributes(
:postgresql => {
:version => "9.1",
:dir => "/etc/postgresql/9.1/main" # IF you don't include this, chef tries to find
} # postgresql config files in /etc/postgresql/8.4/main
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment