Skip to content

Instantly share code, notes, and snippets.

@juliandunn
Created January 24, 2013 03:57
Show Gist options
  • Save juliandunn/4617515 to your computer and use it in GitHub Desktop.
Save juliandunn/4617515 to your computer and use it in GitHub Desktop.
Example of PostgreSQL global development group Chef recipe
#
# Cookbook Name:: smpostgresql
# Recipe:: pgdg
#
# Copyright 2012-2013 SecondMarket Labs, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_recipe "yum"
# Set the version you want at the node level. e.g."9.0", "9.1", "9.2"
# node.set['postgresql']['version'] = "9.2"
node.set['postgresql']['dir'] = "/var/lib/pgsql/#{node['postgresql']['version']}/data"
node.set['postgresql']['client']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-devel"]
node.set['postgresql']['server']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-server"]
node.set['postgresql']['server']['service_name'] = "postgresql-#{node['postgresql']['version']}"
yum_key "RPM-GPG-KEY-PGDG-#{node['postgresql']['version'].split('.').join}" do
url "http://yum.postgresql.org/RPM-GPG-KEY-PGDG-#{node['postgresql']['version'].split('.').join}"
action :add
end
yum_repository "pgdg#{node['postgresql']['version'].split('.').join}" do
description "PostgreSQL #{node['postgresql']['version']} $releasever - $basearch"
url "http://yum.postgresql.org/#{node['postgresql']['version']}/redhat/rhel-$releasever-$basearch"
key "RPM-GPG-KEY-PGDG-#{node['postgresql']['version'].split('.').join}"
action :add
end
yum_repository "pgdg#{node['postgresql']['version'].split('.').join}-source" do
description "PostgreSQL #{node['postgresql']['version']} $releasever - $basearch - Source"
url "http://yum.postgresql.org/srpms/#{node['postgresql']['version']}/redhat/rhel-$releasever-$basearch"
key "RPM-GPG-KEY-PGDG-#{node['postgresql']['version'].split('.').join}"
enabled 0
action :add
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment