server_maint 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +0 -3
- data/lib/server_maint/version.rb +1 -1
- metadata +5 -20
- data/lib/cookbooks/postgresql/CHANGELOG.md +0 -35
- data/lib/cookbooks/postgresql/CONTRIBUTING +0 -29
- data/lib/cookbooks/postgresql/LICENSE +0 -201
- data/lib/cookbooks/postgresql/README.md +0 -148
- data/lib/cookbooks/postgresql/attributes/default.rb +0 -103
- data/lib/cookbooks/postgresql/metadata.rb +0 -21
- data/lib/cookbooks/postgresql/recipes/client.rb +0 -26
- data/lib/cookbooks/postgresql/recipes/default.rb +0 -20
- data/lib/cookbooks/postgresql/recipes/ruby.rb +0 -40
- data/lib/cookbooks/postgresql/recipes/server.rb +0 -64
- data/lib/cookbooks/postgresql/recipes/server_debian.rb +0 -64
- data/lib/cookbooks/postgresql/recipes/server_redhat.rb +0 -77
- data/lib/cookbooks/postgresql/templates/default/debian.postgresql.conf.erb +0 -499
- data/lib/cookbooks/postgresql/templates/default/pg_hba.conf.erb +0 -83
- data/lib/cookbooks/postgresql/templates/default/redhat.postgresql.conf.erb +0 -501
@@ -1,40 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Cookbook Name:: postgresql
|
3
|
-
# Recipe:: ruby
|
4
|
-
#
|
5
|
-
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
6
|
-
# Copyright 2012 Opscode, Inc.
|
7
|
-
#
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
#
|
20
|
-
|
21
|
-
begin
|
22
|
-
require 'pg'
|
23
|
-
rescue LoadError
|
24
|
-
execute "apt-get update" do
|
25
|
-
ignore_failure true
|
26
|
-
action :nothing
|
27
|
-
end.run_action(:run) if node['platform_family'] == "debian"
|
28
|
-
|
29
|
-
node.set['build_essential']['compiletime'] = true
|
30
|
-
include_recipe "build-essential"
|
31
|
-
include_recipe "postgresql::client"
|
32
|
-
|
33
|
-
node['postgresql']['client']['packages'].each do |pg_pack|
|
34
|
-
|
35
|
-
resources("package[#{pg_pack}]").run_action(:install)
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
chef_gem "pg"
|
40
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
#/postgresql.conf.
|
2
|
-
# Cookbook Name:: postgresql
|
3
|
-
# Recipe:: server
|
4
|
-
#
|
5
|
-
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
6
|
-
# Author:: Lamont Granquist (<lamont@opscode.com>)
|
7
|
-
# Copyright 2009-2011, Opscode, Inc.
|
8
|
-
#
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
-
# you may not use this file except in compliance with the License.
|
11
|
-
# You may obtain a copy of the License at
|
12
|
-
#
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
-
#
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
|
22
|
-
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
|
23
|
-
|
24
|
-
include_recipe "postgresql::client"
|
25
|
-
|
26
|
-
# randomly generate postgres password
|
27
|
-
node.set_unless['postgresql']['password']['postgres'] = secure_password
|
28
|
-
node.save unless Chef::Config[:solo]
|
29
|
-
|
30
|
-
if node['postgresql']['version'].to_f <= 8.3
|
31
|
-
node.default['postgresql']['ssl'] = "off"
|
32
|
-
else
|
33
|
-
node.default['postgresql']['ssl'] = "true"
|
34
|
-
end
|
35
|
-
|
36
|
-
# Include the right "family" recipe for installing the server
|
37
|
-
# since they do things slightly differently.
|
38
|
-
case node['platform']
|
39
|
-
when "redhat", "centos", "fedora", "suse", "scientific", "amazon"
|
40
|
-
include_recipe "postgresql::server_redhat"
|
41
|
-
when "debian", "ubuntu"
|
42
|
-
include_recipe "postgresql::server_debian"
|
43
|
-
end
|
44
|
-
|
45
|
-
template "#{node['postgresql']['dir']}/pg_hba.conf" do
|
46
|
-
source "pg_hba.conf.erb"
|
47
|
-
owner "postgres"
|
48
|
-
group "postgres"
|
49
|
-
mode 00600
|
50
|
-
notifies :reload, resources(:service => "postgresql"), :immediately
|
51
|
-
end
|
52
|
-
|
53
|
-
# Default PostgreSQL install has 'ident' checking on unix user 'postgres'
|
54
|
-
# and 'md5' password checking with connections from 'localhost'. This script
|
55
|
-
# runs as user 'postgres', so we can execute the 'role' and 'database' resources
|
56
|
-
# as 'root' later on, passing the below credentials in the PG client.
|
57
|
-
bash "assign-postgres-password" do
|
58
|
-
user 'postgres'
|
59
|
-
code <<-EOH
|
60
|
-
echo "ALTER ROLE postgres ENCRYPTED PASSWORD '#{node['postgresql']['password']['postgres']}';" | psql
|
61
|
-
EOH
|
62
|
-
not_if "echo '\connect' | PGPASSWORD=#{node['postgresql']['password']['postgres']} psql --username=postgres --no-password -h localhost"
|
63
|
-
action :run
|
64
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Cookbook Name:: postgresql
|
3
|
-
# Recipe:: server
|
4
|
-
#
|
5
|
-
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
6
|
-
# Author:: Lamont Granquist (<lamont@opscode.com>)#
|
7
|
-
# Copyright 2009-2011, Opscode, Inc.
|
8
|
-
#
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
-
# you may not use this file except in compliance with the License.
|
11
|
-
# You may obtain a copy of the License at
|
12
|
-
#
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
-
#
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
|
22
|
-
include_recipe "postgresql::client"
|
23
|
-
|
24
|
-
|
25
|
-
if node['postgresql']['version'].to_f <= 8.3
|
26
|
-
node.default['postgresql']['ssl'] = "off"
|
27
|
-
else
|
28
|
-
node.default['postgresql']['ssl'] = "true"
|
29
|
-
end
|
30
|
-
|
31
|
-
node['postgresql']['server']['packages'].each do |pg_pack|
|
32
|
-
package pg_pack do
|
33
|
-
action :install
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
service "postgresql" do
|
38
|
-
case node['platform']
|
39
|
-
when "ubuntu"
|
40
|
-
case
|
41
|
-
when node['platform_version'].to_f <= 10.04
|
42
|
-
service_name "postgresql-#{node['postgresql']['version']}"
|
43
|
-
else
|
44
|
-
service_name "postgresql"
|
45
|
-
end
|
46
|
-
when "debian"
|
47
|
-
case
|
48
|
-
when node['platform_version'].to_f <= 5.0
|
49
|
-
service_name "postgresql-#{node['postgresql']['version']}"
|
50
|
-
else
|
51
|
-
service_name "postgresql"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
supports :restart => true, :status => true, :reload => true
|
55
|
-
action [:enable, :start]
|
56
|
-
end
|
57
|
-
|
58
|
-
template "#{node['postgresql']['dir']}/postgresql.conf" do
|
59
|
-
source "debian.postgresql.conf.erb"
|
60
|
-
owner "postgres"
|
61
|
-
group "postgres"
|
62
|
-
mode 0600
|
63
|
-
notifies :restart, resources(:service => "postgresql"), :immediately
|
64
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Cookbook Name:: postgresql
|
3
|
-
# Recipe:: server
|
4
|
-
#
|
5
|
-
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
6
|
-
# Author:: Lamont Granquist (<lamont@opscode.com>)
|
7
|
-
# Copyright 2009-2011, Opscode, Inc.
|
8
|
-
#
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
-
# you may not use this file except in compliance with the License.
|
11
|
-
# You may obtain a copy of the License at
|
12
|
-
#
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
-
#
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
|
22
|
-
include_recipe "postgresql::client"
|
23
|
-
|
24
|
-
# Create a group and user like the package will.
|
25
|
-
# Otherwise the templates fail.
|
26
|
-
|
27
|
-
group "postgres" do
|
28
|
-
gid 26
|
29
|
-
end
|
30
|
-
|
31
|
-
user "postgres" do
|
32
|
-
shell "/bin/bash"
|
33
|
-
comment "PostgreSQL Server"
|
34
|
-
home "/var/lib/pgsql"
|
35
|
-
gid "postgres"
|
36
|
-
system true
|
37
|
-
uid 26
|
38
|
-
supports :manage_home => false
|
39
|
-
end
|
40
|
-
|
41
|
-
node['postgresql']['server']['packages'].each do |pg_pack|
|
42
|
-
package pg_pack do
|
43
|
-
action :install
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
case node['platform']
|
48
|
-
when "redhat","centos","scientific"
|
49
|
-
case
|
50
|
-
when node['platform_version'].to_f >= 6.0
|
51
|
-
package "postgresql-server"
|
52
|
-
else
|
53
|
-
package "postgresql#{node['postgresql']['version'].split('.').join}-server"
|
54
|
-
end
|
55
|
-
when "fedora","suse"
|
56
|
-
package "postgresql-server"
|
57
|
-
end
|
58
|
-
|
59
|
-
# Following not valid for 9.x version of postgresql
|
60
|
-
if node['postgresql']['version'].to_f < 9.0
|
61
|
-
execute "/sbin/service postgresql initdb" do
|
62
|
-
not_if { ::FileTest.exist?(File.join(node['postgresql']['dir'], "PG_VERSION")) }
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
service "postgresql" do
|
67
|
-
supports :restart => true, :status => true, :reload => true
|
68
|
-
action [:enable, :start]
|
69
|
-
end
|
70
|
-
|
71
|
-
template "#{node['postgresql']['dir']}/postgresql.conf" do
|
72
|
-
source "redhat.postgresql.conf.erb"
|
73
|
-
owner "postgres"
|
74
|
-
group "postgres"
|
75
|
-
mode 0600
|
76
|
-
notifies :restart, resources(:service => "postgresql"), :immediately
|
77
|
-
end
|