]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/postgresql/recipes/default.rb
Don't try and install rubygems for ruby 2.1
[chef.git] / cookbooks / postgresql / recipes / default.rb
index 9dfde244856f3fbc2d2baccb0f9c650912e57d33..a0d9f0e90a3de04b165753cb8bf2e6958c92c70b 100644 (file)
 
 package "postgresql-common"
 
-service "postgresql" do
-  action [ :enable, :start ]
-  supports :status => true, :restart => true, :reload => true
-end
-
 node[:postgresql][:versions].each do |version|
   package "postgresql-#{version}"
   package "postgresql-client-#{version}"
@@ -89,6 +84,11 @@ node[:postgresql][:versions].each do |version|
   end
 end
 
+service "postgresql" do
+  action [:enable, :start]
+  supports :status => true, :restart => true, :reload => true
+end
+
 ohai_plugin "postgresql" do
   template "ohai.rb.erb"
 end
@@ -98,7 +98,7 @@ package "libdbd-pg-perl"
 
 clusters = node[:postgresql][:clusters] || []
 
-clusters.each do |name,details|
+clusters.each do |name, details|
   suffix = name.tr("/", ":")
 
   munin_plugin "postgres_bgwriter_#{suffix}" do
@@ -131,11 +131,11 @@ clusters.each do |name,details|
     conf_variables :port => details[:port]
   end
 
-  if File.exist?("/var/lib/postgresql/#{details[:version]}/main/recovery.conf")
-    munin_plugin "postgres_replication_#{suffix}" do
-      target "postgres_replication"
-      conf "munin.erb"
-      conf_variables :port => details[:port]
-    end
+  next unless File.exist?("/var/lib/postgresql/#{details[:version]}/main/recovery.conf")
+
+  munin_plugin "postgres_replication_#{suffix}" do
+    target "postgres_replication"
+    conf "munin.erb"
+    conf_variables :port => details[:port]
   end
 end