Permalink
Browse files

Merge branch 'COOK-2232'

  • Loading branch information...
2 parents cdeb1cc + bf66ba1 commit bf1c0b5541f0abe626fb9ad45d1aac27812f4d95 @jtimberman jtimberman committed Jan 22, 2013
Showing with 49 additions and 19 deletions.
  1. +12 −0 README.md
  2. +11 −3 attributes/default.rb
  3. +24 −0 recipes/contrib.rb
  4. +2 −16 recipes/server_redhat.rb
View
@@ -46,6 +46,8 @@ The following attributes are set based on the platform, see the
that should be installed on "client" systems.
* `node['postgresql']['server']['packages']` - An array of package names
that should be installed on "server" systems.
+* `node['postgresql']['contrib']['packages']` - An array of package names
+ that could be installed on "server" systems for useful sysadmin tools.
* `node['postgresql']['enable_pitti_ppa']` - Whether to enable the PPA
by Martin Pitti, which contains newer versions of PostgreSQL. See
@@ -174,6 +176,16 @@ database, and manages the postgresql service. You should include the
`postgresql::server` recipe, which will include this on RHEL/Fedora
platforms.
+contrib
+-------
+
+Installs the packages defined in the
+`node['postgresql']['contrib']['packages']` attribute.
+This is the contrib directory of the PostgreSQL distribution, which
+includes porting tools, analysis utilities, and plug-in features that
+database engineers often require. Some (like pgbench) are executable.
+Others (like pg_buffercache) should be installed into the database.
+
ppa\_pitti\_postgresql
----------------------
View
@@ -21,24 +21,25 @@
when "debian"
case
- when node['platform_version'].to_f <= 5.0
+ when node['platform_version'].to_f < 6.0 # All 5.X
default['postgresql']['version'] = "8.3"
- when node['platform_version'].to_f == 6.0
+ when node['platform_version'].to_f < 7.0 # All 6.X
default['postgresql']['version'] = "8.4"
else
default['postgresql']['version'] = "9.1"
end
default['postgresql']['dir'] = "/etc/postgresql/#{node['postgresql']['version']}/main"
case
- when node['platform_version'].to_f <= 5.0
+ when node['platform_version'].to_f < 6.0 # All 5.X
default['postgresql']['server']['service_name'] = "postgresql-#{node['postgresql']['version']}"
else
default['postgresql']['server']['service_name'] = "postgresql"
end
default['postgresql']['client']['packages'] = %w{postgresql-client libpq-dev}
default['postgresql']['server']['packages'] = %w{postgresql}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
when "ubuntu"
@@ -61,6 +62,7 @@
default['postgresql']['client']['packages'] = %w{postgresql-client libpq-dev}
default['postgresql']['server']['packages'] = %w{postgresql}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
when "fedora"
@@ -73,6 +75,7 @@
default['postgresql']['dir'] = "/var/lib/pgsql/data"
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['server']['packages'] = %w{postgresql-server}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
default['postgresql']['server']['service_name'] = "postgresql"
when "amazon"
@@ -81,6 +84,7 @@
default['postgresql']['dir'] = "/var/lib/pgsql/data"
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['server']['packages'] = %w{postgresql-server}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
default['postgresql']['server']['service_name'] = "postgresql"
when "redhat", "centos", "scientific", "oracle"
@@ -91,9 +95,11 @@
if node['platform_version'].to_f >= 6.0
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['server']['packages'] = %w{postgresql-server}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
else
default['postgresql']['client']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-devel"]
default['postgresql']['server']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-server"]
+ default['postgresql']['contrib']['packages'] = ["postgresql#{node['postgresql']['version'].split('.').join}-contrib"]
end
default['postgresql']['server']['service_name'] = "postgresql"
@@ -108,13 +114,15 @@
default['postgresql']['dir'] = "/var/lib/pgsql/data"
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['server']['packages'] = %w{postgresql-server}
+ default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
default['postgresql']['server']['service_name'] = "postgresql"
else
default['postgresql']['version'] = "8.4"
default['postgresql']['dir'] = "/etc/postgresql/#{node['postgresql']['version']}/main"
default['postgresql']['client']['packages'] = ["postgresql"]
default['postgresql']['server']['packages'] = ["postgresql"]
+ default['postgresql']['contrib']['packages'] = ["postgresql"]
default['postgresql']['server']['service_name'] = "postgresql"
end
View
@@ -0,0 +1,24 @@
+#
+# Cookbook Name:: postgresql
+# Recipe:: contrib
+#
+# 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 "postgresql::server"
+
+node['postgresql']['contrib']['packages'].each do |pg_pack|
+
+ package pg_pack
+
+end
@@ -44,22 +44,8 @@
end
-case node['platform_family']
-when "rhel"
- case
- when node['platform_version'].to_f >= 6.0
- package "postgresql-server"
- else
- package "postgresql#{node['postgresql']['version'].split('.').join}-server"
- end
-when "fedora", "suse"
- package "postgresql-server"
-end
-
-if node['postgresql']['version'].to_f < 9.0
- execute "/sbin/service #{node['postgresql']['server']['service_name']} initdb" do
- not_if { ::FileTest.exist?(File.join(node['postgresql']['dir'], "PG_VERSION")) }
- end
+execute "/sbin/service #{node['postgresql']['server']['service_name']} initdb" do
+ not_if { ::FileTest.exist?(File.join(node['postgresql']['dir'], "PG_VERSION")) }
end
service "postgresql" do

0 comments on commit bf1c0b5

Please sign in to comment.