le1t0-deprec 2.1.6.001
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +444 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +154 -0
- data/THANKS +17 -0
- data/bin/depify +139 -0
- data/docs/EXAMPLE-installing_tracks.txt +41 -0
- data/docs/README.nagios +22 -0
- data/docs/README.rails +17 -0
- data/docs/config_gen_explained.txt +39 -0
- data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
- data/docs/deprec-1.x/notes.txt +12 -0
- data/docs/old/deprec_banner.gif +0 -0
- data/docs/windows_linux.txt +350 -0
- data/docs/xen/traffic_monitoring_with_vnstat.txt +95 -0
- data/docs/xen/xen-tools-notes.txt +31 -0
- data/docs/xen/xen_on_hardy.txt +39 -0
- data/lib/deprec.rb +42 -0
- data/lib/deprec/capistrano_extensions.rb +446 -0
- data/lib/deprec/recipes.rb +7 -0
- data/lib/deprec/recipes/aoe.rb +79 -0
- data/lib/deprec/recipes/app/mongrel.rb +213 -0
- data/lib/deprec/recipes/app/passenger.rb +190 -0
- data/lib/deprec/recipes/ar_sendmail.rb +67 -0
- data/lib/deprec/recipes/aspell.rb +22 -0
- data/lib/deprec/recipes/canonical.rb +68 -0
- data/lib/deprec/recipes/cap.rb +39 -0
- data/lib/deprec/recipes/chef.rb +68 -0
- data/lib/deprec/recipes/collectd.rb +112 -0
- data/lib/deprec/recipes/db/couchdb.rb +107 -0
- data/lib/deprec/recipes/db/mysql.rb +194 -0
- data/lib/deprec/recipes/db/postgresql.rb +104 -0
- data/lib/deprec/recipes/db/sqlite.rb +37 -0
- data/lib/deprec/recipes/ddclient.rb +51 -0
- data/lib/deprec/recipes/deprec.rb +167 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/drbd.rb +137 -0
- data/lib/deprec/recipes/dummy.rb +22 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +97 -0
- data/lib/deprec/recipes/gitosis.rb.disabled +55 -0
- data/lib/deprec/recipes/glusterfs.rb +176 -0
- data/lib/deprec/recipes/god.rb +70 -0
- data/lib/deprec/recipes/haproxy.rb +115 -0
- data/lib/deprec/recipes/heartbeat.rb +138 -0
- data/lib/deprec/recipes/imagemagick/imagemagick_bin.rb +24 -0
- data/lib/deprec/recipes/imagemagick/imagemagick_src.rb +39 -0
- data/lib/deprec/recipes/integrity.rb +108 -0
- data/lib/deprec/recipes/iptables.rb +94 -0
- data/lib/deprec/recipes/java.rb +23 -0
- data/lib/deprec/recipes/keepalived.rb +78 -0
- data/lib/deprec/recipes/ldap.rb +52 -0
- data/lib/deprec/recipes/logrotate.rb +56 -0
- data/lib/deprec/recipes/lvm.rb +20 -0
- data/lib/deprec/recipes/memcache.rb +49 -0
- data/lib/deprec/recipes/mongodb.rb +94 -0
- data/lib/deprec/recipes/monit.rb +135 -0
- data/lib/deprec/recipes/mysql_proxy.rb +67 -0
- data/lib/deprec/recipes/nagios.rb +361 -0
- data/lib/deprec/recipes/network.rb +116 -0
- data/lib/deprec/recipes/ntp.rb +103 -0
- data/lib/deprec/recipes/php.rb +58 -0
- data/lib/deprec/recipes/postfix.rb +115 -0
- data/lib/deprec/recipes/profiles.rb +125 -0
- data/lib/deprec/recipes/raid/amcc_3ware.rb +21 -0
- data/lib/deprec/recipes/rails.rb +330 -0
- data/lib/deprec/recipes/redhat_cluster.rb +228 -0
- data/lib/deprec/recipes/redis.rb +90 -0
- data/lib/deprec/recipes/ruby/mri.rb +55 -0
- data/lib/deprec/recipes/ruby/ree.rb +40 -0
- data/lib/deprec/recipes/rvm.rb +32 -0
- data/lib/deprec/recipes/s3utils.rb +63 -0
- data/lib/deprec/recipes/sphinx/thinking_sphinx.rb +105 -0
- data/lib/deprec/recipes/sphinx/ultrasphinx.rb +86 -0
- data/lib/deprec/recipes/ssh.rb +147 -0
- data/lib/deprec/recipes/ssl.rb +56 -0
- data/lib/deprec/recipes/starling.rb +119 -0
- data/lib/deprec/recipes/svn.rb +171 -0
- data/lib/deprec/recipes/syslog.rb +63 -0
- data/lib/deprec/recipes/trac.rb.disabled +277 -0
- data/lib/deprec/recipes/tsung.rb +74 -0
- data/lib/deprec/recipes/ubuntu.rb +90 -0
- data/lib/deprec/recipes/users.rb +90 -0
- data/lib/deprec/recipes/utils.rb +58 -0
- data/lib/deprec/recipes/vnstat.rb +85 -0
- data/lib/deprec/recipes/web/apache.rb +143 -0
- data/lib/deprec/recipes/web/nginx.rb +172 -0
- data/lib/deprec/recipes/wordpress.rb.notworking +96 -0
- data/lib/deprec/recipes/wpmu.rb +103 -0
- data/lib/deprec/recipes/xen.rb +364 -0
- data/lib/deprec/recipes/xentools.rb +101 -0
- data/lib/deprec/recipes_minus_rails.rb +125 -0
- data/lib/deprec/templates/aoe/aoe-init +55 -0
- data/lib/deprec/templates/aoe/fence_aoemask +351 -0
- data/lib/deprec/templates/apache/namevirtualhosts.conf +5 -0
- data/lib/deprec/templates/apache/ports.conf.erb +5 -0
- data/lib/deprec/templates/apache/status.conf.erb +17 -0
- data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
- data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
- data/lib/deprec/templates/chef/chef.json.erb +1 -0
- data/lib/deprec/templates/chef/solo.rb +2 -0
- data/lib/deprec/templates/collectd/collectd-init.d +153 -0
- data/lib/deprec/templates/collectd/collectd.conf.erb +686 -0
- data/lib/deprec/templates/ddclient/ddclient.conf.erb +11 -0
- data/lib/deprec/templates/ddclient/ddclient.erb +15 -0
- data/lib/deprec/templates/deprec/caprc.erb +14 -0
- data/lib/deprec/templates/drbd/drbd.conf.erb +531 -0
- data/lib/deprec/templates/glusterfs/glusterfsd-init.erb +95 -0
- data/lib/deprec/templates/gnbd_client/cluster.conf.erb +21 -0
- data/lib/deprec/templates/gnbd_client/clvm-default.erb +3 -0
- data/lib/deprec/templates/gnbd_client/cman-default.erb +6 -0
- data/lib/deprec/templates/gnbd_client/gnbdimports.conf.erb +1 -0
- data/lib/deprec/templates/gnbd_server/cluster.conf.erb +20 -0
- data/lib/deprec/templates/gnbd_server/clvm-default.erb +3 -0
- data/lib/deprec/templates/gnbd_server/cman-default.erb +6 -0
- data/lib/deprec/templates/gnbd_server/gnbd-server-default.erb +1 -0
- data/lib/deprec/templates/gnbd_server/gnbdexports.conf.erb +1 -0
- data/lib/deprec/templates/god/god-conf.erb +2 -0
- data/lib/deprec/templates/god/god-init.erb +47 -0
- data/lib/deprec/templates/haproxy/haproxy-init.d +120 -0
- data/lib/deprec/templates/haproxy/haproxy.cfg.erb +31 -0
- data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
- data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
- data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
- data/lib/deprec/templates/integrity/apache_vhost.erb +4 -0
- data/lib/deprec/templates/integrity/config.ru.erb +21 -0
- data/lib/deprec/templates/integrity/config.yml.erb +43 -0
- data/lib/deprec/templates/iptables/firewall-default.erb +13 -0
- data/lib/deprec/templates/iptables/firewall-init.erb +171 -0
- data/lib/deprec/templates/keepalived/keepalived.conf.erb +18 -0
- data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/mongodb/mongodb-init.d +88 -0
- data/lib/deprec/templates/mongrel/apache_vhost.conf.erb +148 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
- data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
- data/lib/deprec/templates/mongrel/nginx_vhost.conf.erb +41 -0
- data/lib/deprec/templates/monit/monit-init-script +104 -0
- data/lib/deprec/templates/monit/monitrc.erb +250 -0
- data/lib/deprec/templates/monit/nothing.monitrc +0 -0
- data/lib/deprec/templates/mysql/create_databases.sql +20 -0
- data/lib/deprec/templates/mysql/database.yml.prod +6 -0
- data/lib/deprec/templates/mysql/database.yml.stage +6 -0
- data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
- data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
- data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
- data/lib/deprec/templates/mysql_proxy/mysql-proxy-default.erb +4 -0
- data/lib/deprec/templates/nagios/README +32 -0
- data/lib/deprec/templates/nagios/cgi.cfg.erb +357 -0
- data/lib/deprec/templates/nagios/check_linux_free_memory.pl +118 -0
- data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -0
- data/lib/deprec/templates/nagios/htpasswd.users +1 -0
- data/lib/deprec/templates/nagios/mrtg.cfg +180 -0
- data/lib/deprec/templates/nagios/nagios.cfg.erb +1325 -0
- data/lib/deprec/templates/nagios/nrpe.cfg.erb +222 -0
- data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
- data/lib/deprec/templates/nagios/objects/commands.cfg.erb +265 -0
- data/lib/deprec/templates/nagios/objects/contacts.cfg.erb +89 -0
- data/lib/deprec/templates/nagios/objects/hosts.cfg.erb +114 -0
- data/lib/deprec/templates/nagios/objects/localhost.cfg.erb +116 -0
- data/lib/deprec/templates/nagios/objects/services.cfg.erb +165 -0
- data/lib/deprec/templates/nagios/objects/timeperiods.cfg.erb +94 -0
- data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
- data/lib/deprec/templates/network/hostname.erb +1 -0
- data/lib/deprec/templates/network/hosts.erb +2 -0
- data/lib/deprec/templates/network/interfaces.erb +18 -0
- data/lib/deprec/templates/network/resolv.conf.erb +6 -0
- data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
- data/lib/deprec/templates/nginx/mime.types.erb +70 -0
- data/lib/deprec/templates/nginx/nginx-init-script +62 -0
- data/lib/deprec/templates/nginx/nginx.conf.erb +125 -0
- data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
- data/lib/deprec/templates/nginx/nothing.conf +1 -0
- data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
- data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
- data/lib/deprec/templates/passenger/apache_vhost.erb +29 -0
- data/lib/deprec/templates/passenger/logrotate.conf.erb +12 -0
- data/lib/deprec/templates/passenger/passenger.conf.erb +21 -0
- data/lib/deprec/templates/passenger/passenger.load.erb +3 -0
- data/lib/deprec/templates/postfix/aliases.erb +3 -0
- data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
- data/lib/deprec/templates/postfix/main.cf.erb +36 -0
- data/lib/deprec/templates/postfix/master.cf.erb +77 -0
- data/lib/deprec/templates/redis/redis-conf.erb +132 -0
- data/lib/deprec/templates/redis/redis-init.erb +50 -0
- data/lib/deprec/templates/s3utils/s3cfg +35 -0
- data/lib/deprec/templates/s3utils/s3config.yml +3 -0
- data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
- data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
- data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
- data/lib/deprec/templates/ssl/make-ssl-cert +138 -0
- data/lib/deprec/templates/ssl/ssl-cert-snakeoil.key +15 -0
- data/lib/deprec/templates/ssl/ssl-cert-snakeoil.pem +19 -0
- data/lib/deprec/templates/starling/monit.conf.erb +14 -0
- data/lib/deprec/templates/starling/starling-init-script.erb +71 -0
- data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
- data/lib/deprec/templates/syslog/syslog.conf.erb +71 -0
- data/lib/deprec/templates/syslog/syslogd.erb +13 -0
- data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
- data/lib/deprec/templates/trac/nginx_vhost.conf.erb +26 -0
- data/lib/deprec/templates/trac/trac.ini.erb +169 -0
- data/lib/deprec/templates/trac/trac_deprec.png +0 -0
- data/lib/deprec/templates/trac/tracd-init.erb +43 -0
- data/lib/deprec/templates/trac/users.htdigest.erb +0 -0
- data/lib/deprec/templates/tsung/tsung.xml.erb +47 -0
- data/lib/deprec/templates/vnstat/config.php +57 -0
- data/lib/deprec/templates/wordpress/apache2_wordpress_vhost.conf.erb +31 -0
- data/lib/deprec/templates/wordpress/wp-config.php.erb +31 -0
- data/lib/deprec/templates/wpmu/apache_vhost.conf.erb +13 -0
- data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
- data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
- data/lib/deprec/templates/xen/xend-init.erb +57 -0
- data/lib/deprec/templates/xen/xendomains.erb +137 -0
- data/lib/deprec/templates/xentools/100-ubuntu-setup +26 -0
- data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xentools/30-disable-gettys +57 -0
- data/lib/deprec/templates/xentools/31-ubuntu-setup +32 -0
- data/lib/deprec/templates/xentools/40-setup-networking +145 -0
- data/lib/deprec/templates/xentools/98-custom +17 -0
- data/lib/deprec/templates/xentools/xen-tools.conf.erb +278 -0
- data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
- data/lib/deprec_cmd_completion.sh +26 -0
- data/lib/deprec_minus_rails.rb +12 -0
- data/lib/vmbuilder_plugins/all.rb +20 -0
- data/lib/vmbuilder_plugins/apt.rb +93 -0
- data/lib/vmbuilder_plugins/emerge.rb +76 -0
- data/lib/vmbuilder_plugins/gem.rb +100 -0
- data/lib/vmbuilder_plugins/std.rb +203 -0
- metadata +304 -0
@@ -0,0 +1,116 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :network do
|
5
|
+
|
6
|
+
set(:network_number_of_ports) {
|
7
|
+
Capistrano::CLI.ui.ask "Number of network interfaces" do |q|
|
8
|
+
q.default = 1
|
9
|
+
end
|
10
|
+
}
|
11
|
+
|
12
|
+
default_network = ''
|
13
|
+
set(:network_interfaces) {
|
14
|
+
result = {}
|
15
|
+
network_number_of_ports.to_i.times do |iface|
|
16
|
+
default_network = "192.168.#{iface+1}"
|
17
|
+
result[iface] = {}
|
18
|
+
result[iface][:address] = Capistrano::CLI.ui.ask "address" do |q|
|
19
|
+
q.default = "#{default_network}.10"
|
20
|
+
end
|
21
|
+
default_network = result[iface][:address].split('.').slice(0,3).join('.')
|
22
|
+
result[iface][:netmask] = Capistrano::CLI.ui.ask "netmask" do |q|
|
23
|
+
q.default = "255.255.255.0"
|
24
|
+
end
|
25
|
+
result[iface][:broadcast] = Capistrano::CLI.ui.ask "broadcast" do |q|
|
26
|
+
q.default = "#{default_network}.255"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
result
|
30
|
+
}
|
31
|
+
set(:network_hostname) {
|
32
|
+
Capistrano::CLI.ui.ask "Enter the hostname for the server" do |q|
|
33
|
+
# q.validate = /add hostname validation here/
|
34
|
+
end
|
35
|
+
}
|
36
|
+
set(:network_gateway) {
|
37
|
+
Capistrano::CLI.ui.ask "default gateway" do |q|
|
38
|
+
q.default = "#{default_network}.1"
|
39
|
+
end
|
40
|
+
}
|
41
|
+
set(:network_dns_nameservers) {
|
42
|
+
Capistrano::CLI.ui.ask "dns nameservers (separated by spaces)" do |q|
|
43
|
+
q.default = '203.8.183.1 4.2.2.1'
|
44
|
+
end
|
45
|
+
}
|
46
|
+
set(:network_dns_search_path) {
|
47
|
+
Capistrano::CLI.ui.ask "dns search domains (separated by spaces)" do |q|
|
48
|
+
q.default = nil
|
49
|
+
end
|
50
|
+
}
|
51
|
+
|
52
|
+
# Non standard deprec!
|
53
|
+
#
|
54
|
+
# I might move to making this standard in future. It makes it easier to
|
55
|
+
# override individual config files in local recipes. - Mike
|
56
|
+
#
|
57
|
+
SYSTEM_CONFIG_FILES[:network] = {
|
58
|
+
|
59
|
+
:interfaces => {
|
60
|
+
:template => "interfaces.erb",
|
61
|
+
:path => '/etc/network/interfaces',
|
62
|
+
:mode => 0644,
|
63
|
+
:owner => 'root:root',
|
64
|
+
:remote => true
|
65
|
+
},
|
66
|
+
|
67
|
+
:hosts => {
|
68
|
+
:template => "hosts.erb",
|
69
|
+
:path => '/etc/hosts',
|
70
|
+
:mode => 0644,
|
71
|
+
:owner => 'root:root',
|
72
|
+
:remote => true
|
73
|
+
},
|
74
|
+
|
75
|
+
:hostname => {
|
76
|
+
:template => "hostname.erb",
|
77
|
+
:path => '/etc/hostname',
|
78
|
+
:mode => 0644,
|
79
|
+
:owner => 'root:root',
|
80
|
+
:remote => true
|
81
|
+
},
|
82
|
+
|
83
|
+
:resolv => {
|
84
|
+
:template => "resolv.conf.erb",
|
85
|
+
:path => '/etc/resolv.conf',
|
86
|
+
:mode => 0644,
|
87
|
+
:owner => 'root:root',
|
88
|
+
:remote => true
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
SYSTEM_CONFIG_FILES[:network].each do |file, details|
|
94
|
+
desc "Generate and push #{details[:path]}"
|
95
|
+
task file.to_sym do
|
96
|
+
deprec2.render_template(:network, details)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# XXX need to set the order for these as it breaks sudo currently
|
101
|
+
desc "Update system networking configuration"
|
102
|
+
task :config do
|
103
|
+
SYSTEM_CONFIG_FILES[:network].values.each do |file|
|
104
|
+
deprec2.render_template(:network, file.merge(:remote=>true))
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
desc "Restart network interface"
|
109
|
+
task :restart do
|
110
|
+
sudo '/etc/init.d/networking restart'
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :ntp do
|
5
|
+
|
6
|
+
# Install
|
7
|
+
|
8
|
+
desc "Install ntp"
|
9
|
+
task :install do
|
10
|
+
install_deps
|
11
|
+
SYSTEM_CONFIG_FILES[:ntp].each do |file|
|
12
|
+
deprec2.render_template(:ntp, file.merge(:remote => true))
|
13
|
+
end
|
14
|
+
activate
|
15
|
+
end
|
16
|
+
|
17
|
+
# install dependencies for nginx
|
18
|
+
task :install_deps do
|
19
|
+
apt.install( {:base => %w(ntp)}, :stable )
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
# Configure
|
24
|
+
|
25
|
+
SYSTEM_CONFIG_FILES[:ntp] = [
|
26
|
+
|
27
|
+
{:template => 'ntp.conf.erb',
|
28
|
+
:path => '/etc/ntp.conf',
|
29
|
+
:mode => 0755,
|
30
|
+
:owner => 'root:root'}
|
31
|
+
]
|
32
|
+
|
33
|
+
desc "Generate ntp config from template."
|
34
|
+
task :config_gen do
|
35
|
+
SYSTEM_CONFIG_FILES[:ntp].each do |file|
|
36
|
+
deprec2.render_template(:ntp, file)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Push ntp config files to server"
|
41
|
+
task :config do
|
42
|
+
deprec2.push_configs(:ntp, SYSTEM_CONFIG_FILES[:ntp])
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'Enable ntp start scripts on server.'
|
46
|
+
task :activate do
|
47
|
+
send(run_method, "update-rc.d ntp defaults")
|
48
|
+
end
|
49
|
+
|
50
|
+
desc 'Disable ntp start scripts on server.'
|
51
|
+
task :deactivate do
|
52
|
+
send(run_method, "update-rc.d -f ntp remove")
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
# Control
|
57
|
+
|
58
|
+
desc "Start ntp"
|
59
|
+
task :start do
|
60
|
+
send(run_method, "/etc/init.d/ntp start")
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Stop ntp"
|
64
|
+
task :stop do
|
65
|
+
send(run_method, "/etc/init.d/ntp stop")
|
66
|
+
end
|
67
|
+
|
68
|
+
desc "Restart ntp"
|
69
|
+
task :restart do
|
70
|
+
send(run_method, "/etc/init.d/ntp restart")
|
71
|
+
end
|
72
|
+
|
73
|
+
desc "Reload ntp"
|
74
|
+
task :reload do
|
75
|
+
puts "use 'restart' instead"
|
76
|
+
exit 1
|
77
|
+
end
|
78
|
+
|
79
|
+
task :backup, :roles => :web do
|
80
|
+
# there's nothing to backup for ntp
|
81
|
+
end
|
82
|
+
|
83
|
+
task :restore, :roles => :web do
|
84
|
+
# there's nothing to store for ntp
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
# Some nice nagios checks
|
93
|
+
#
|
94
|
+
# Check important hosts have expected DNS
|
95
|
+
#
|
96
|
+
# root@sm02:/usr/local/nagios/libexec# ./check_dns --hostname=astro.blocksglobal.com --expected-address=116.240.200.167
|
97
|
+
# DNS OK: 0.009 seconds response time. astro.blocksglobal.com returns 116.240.200.167|time=0.008744s;;;0.000000
|
98
|
+
#
|
99
|
+
#
|
100
|
+
|
101
|
+
# reconfigure timezone on hardy
|
102
|
+
#
|
103
|
+
# dpkg-reconfigure tzdata
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :php do
|
5
|
+
|
6
|
+
desc "Install PHP"
|
7
|
+
task :install do
|
8
|
+
install_deps
|
9
|
+
end
|
10
|
+
|
11
|
+
# Install dependencies for php
|
12
|
+
task :install_deps do
|
13
|
+
apt.install( {:base => %w(php5 php5-mysql)}, :stable )
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "generate config file for php"
|
17
|
+
task :config_gen do
|
18
|
+
# not yet implemented
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "deploy config file for php"
|
22
|
+
task :config, :roles => :web do
|
23
|
+
# not yet implemented
|
24
|
+
end
|
25
|
+
|
26
|
+
task :start, :roles => :web do
|
27
|
+
# not applicable
|
28
|
+
end
|
29
|
+
|
30
|
+
task :stop, :roles => :web do
|
31
|
+
# not applicable
|
32
|
+
end
|
33
|
+
|
34
|
+
task :restart, :roles => :web do
|
35
|
+
# not applicable
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "enable php in webserver"
|
39
|
+
task :activate, :roles => :web do
|
40
|
+
# not yet implemented
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "disable php in webserver"
|
44
|
+
task :deactivate, :roles => :web do
|
45
|
+
# not yet implemented
|
46
|
+
end
|
47
|
+
|
48
|
+
task :backup, :roles => :web do
|
49
|
+
# not applicable
|
50
|
+
end
|
51
|
+
|
52
|
+
task :restore, :roles => :web do
|
53
|
+
# not applicable
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
# XXX not complete
|
4
|
+
namespace :deprec do
|
5
|
+
namespace :postfix do
|
6
|
+
|
7
|
+
set(:postfix_relayhost) { Capistrano::CLI.ui.ask "What host should we relay mail through?" }
|
8
|
+
|
9
|
+
desc "Install Postfix"
|
10
|
+
task :install, :roles => :mail do
|
11
|
+
install_deps
|
12
|
+
end
|
13
|
+
|
14
|
+
# Install dependencies for Postfix
|
15
|
+
task :install_deps, :roles => :mail do
|
16
|
+
# mutt and mailx are useful tools for testing mail
|
17
|
+
# e.g. echo test | mail test@gmail.com
|
18
|
+
apt.install( {:base => %w(postfix mutt mailx)}, :stable )
|
19
|
+
end
|
20
|
+
|
21
|
+
# This is my default Postfix setup on servers that
|
22
|
+
# aren't my main outgoing mailserver.
|
23
|
+
# It accepts mail from localhost only and relays
|
24
|
+
# all mail to a master mailserver for delivery.
|
25
|
+
#
|
26
|
+
SYSTEM_CONFIG_FILES[:postfix] = [
|
27
|
+
|
28
|
+
{:template => "main.cf.erb",
|
29
|
+
:path => '/etc/postfix/main.cf',
|
30
|
+
:mode => 0644,
|
31
|
+
:owner => 'root:root'},
|
32
|
+
|
33
|
+
{:template => "master.cf.erb",
|
34
|
+
:path => '/etc/postfix/master.cf',
|
35
|
+
:mode => 0644,
|
36
|
+
:owner => 'root:root'},
|
37
|
+
|
38
|
+
{:template => "dynamicmaps.cf.erb",
|
39
|
+
:path => '/etc/postfix/dynamicmaps.cf',
|
40
|
+
:mode => 0644,
|
41
|
+
:owner => 'root:root'},
|
42
|
+
|
43
|
+
{:template => "aliases.erb",
|
44
|
+
:path => '/etc/aliases',
|
45
|
+
:mode => 0644,
|
46
|
+
:owner => 'root:root'}
|
47
|
+
|
48
|
+
]
|
49
|
+
|
50
|
+
desc 'Generate configuration files(s) for postfix'
|
51
|
+
task :config_gen do
|
52
|
+
SYSTEM_CONFIG_FILES[:postfix].each do |file|
|
53
|
+
deprec2.render_template(:postfix, file)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
desc 'Deploy configuration files(s) for postfix'
|
58
|
+
task :config, :roles => :mail, :except => { :master => true } do
|
59
|
+
deprec2.push_configs(:postfix, SYSTEM_CONFIG_FILES[:postfix])
|
60
|
+
send(run_method, "/usr/bin/newaliases")
|
61
|
+
reload
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Start Postfix"
|
65
|
+
task :start, :roles => :mail, :except => { :master => true } do
|
66
|
+
send(run_method, "/etc/init.d/postfix start")
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "Stop Postfix"
|
70
|
+
task :stop, :roles => :mail, :except => { :master => true } do
|
71
|
+
send(run_method, "/etc/init.d/postfix stop")
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "Restart Postfix"
|
75
|
+
task :restart, :roles => :mail, :except => { :master => true } do
|
76
|
+
send(run_method, "/etc/init.d/postfix restart")
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "Reload Postfix"
|
80
|
+
task :reload, :roles => :mail, :except => { :master => true } do
|
81
|
+
send(run_method, "/etc/init.d/postfix reload")
|
82
|
+
end
|
83
|
+
|
84
|
+
task :activate, :roles => :web do
|
85
|
+
end
|
86
|
+
|
87
|
+
task :deactivate, :roles => :web do
|
88
|
+
end
|
89
|
+
|
90
|
+
task :backup, :roles => :web do
|
91
|
+
end
|
92
|
+
|
93
|
+
task :restore, :roles => :web do
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
# Capistrano::Configuration.instance(:must_exist).load do
|
102
|
+
#
|
103
|
+
# namespace :deprec do namespace :nginx do
|
104
|
+
#
|
105
|
+
# #Craig: I've kept this generic rather than calling the task setup postfix.
|
106
|
+
# # if people want other smtp servers, it could be configurable
|
107
|
+
# desc "install and configure postfix"
|
108
|
+
# task :setup_smtp_server do
|
109
|
+
# install_postfix
|
110
|
+
# set :postfix_destination_domains, [domain] + apache_server_aliases
|
111
|
+
# deprec.render_template_to_file('postfix_main', '/etc/postfix/main.cf')
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# end end
|
115
|
+
# end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# Copyright 2009-2010 by le1t0@github. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
class DeprecProfile
|
4
|
+
attr_accessor :tasks_to_call
|
5
|
+
attr_accessor :current_task
|
6
|
+
attr_accessor :sub_namespace
|
7
|
+
attr_accessor :literal
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@tasks_to_call = []
|
11
|
+
@sub_namespace = false
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
if !@sub_namespace
|
16
|
+
finalize
|
17
|
+
@literal = true # can't set directly in current_task, since it will run finalize again in method_missing then (wrongly)
|
18
|
+
end
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
def method_missing(method_name, *args, &block)
|
23
|
+
obj = nil
|
24
|
+
if !@sub_namespace
|
25
|
+
finalize
|
26
|
+
@current_task ||= {}
|
27
|
+
@current_task[:literal] = true if @literal
|
28
|
+
@literal = false
|
29
|
+
@current_task[:name] = method_name.to_s
|
30
|
+
@current_task[:args] = args.size == 0 ? nil : args.flatten
|
31
|
+
obj = self.dup
|
32
|
+
obj.sub_namespace = true
|
33
|
+
else
|
34
|
+
@current_task[:name] = [ @current_task[:name], method_name.to_s ].join('.')
|
35
|
+
@current_task[:args] = args.size == 0 ? nil : args.flatten
|
36
|
+
obj = self
|
37
|
+
end
|
38
|
+
obj
|
39
|
+
end
|
40
|
+
|
41
|
+
def finalize
|
42
|
+
if !@current_task.nil?
|
43
|
+
@tasks_to_call << @current_task
|
44
|
+
@current_task = nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def profile(profile_task_name, *only_recipe_tasks, &block)
|
50
|
+
only_recipe_tasks = [ :config_gen, :install, :config, :activate, :start ] if only_recipe_tasks.size == 0
|
51
|
+
yield(profiles = DeprecProfile.new, recipes = DeprecProfile.new)
|
52
|
+
profiles.finalize
|
53
|
+
recipes.finalize
|
54
|
+
([ :all ] + only_recipe_tasks).each do |tsk|
|
55
|
+
cmd = "
|
56
|
+
namespace :deprec do\nnamespace :profiles do\nnamespace :#{profile_task_name} do\nnamespace :distclean do\ndesc '#{profile_task_name}:distclean:#{tsk}'\ntask :#{tsk} do\n
|
57
|
+
remove_profile_stamps('#{profile_task_name}:#{tsk}')\nend\nend\nend\nend\nend
|
58
|
+
"
|
59
|
+
puts cmd if ENV['DEBUG_PROFILES']
|
60
|
+
eval(cmd)
|
61
|
+
end
|
62
|
+
cmd = "
|
63
|
+
namespace :deprec do\nnamespace :profiles do\nnamespace :#{profile_task_name} do\ndesc '#{profile_task_name}:all'\ntask :all do\n
|
64
|
+
#{only_recipe_tasks.collect do |n|
|
65
|
+
"unless profile_stamp_exists?('#{profile_task_name}:all', '#{profile_task_name}', '#{n}') ; then
|
66
|
+
top.deprec.profiles.#{profile_task_name}.#{n}
|
67
|
+
profile_stamp('#{profile_task_name}:all', '#{profile_task_name}', '#{n}')
|
68
|
+
end
|
69
|
+
" end.join("\n")}\n
|
70
|
+
remove_profile_stamps('#{profile_task_name}:all')\nend\nend\nend\nend
|
71
|
+
"
|
72
|
+
puts cmd if ENV['DEBUG_PROFILES']
|
73
|
+
eval(cmd)
|
74
|
+
only_recipe_tasks.each do |rt|
|
75
|
+
cmd = "
|
76
|
+
desc '#{profile_task_name}:#{rt}'\nnamespace :deprec do\nnamespace :profiles do\nnamespace :#{profile_task_name} do\ntask :#{rt} do\n
|
77
|
+
#{profiles.tasks_to_call.collect do |tsk|
|
78
|
+
(tsk[:args] || only_recipe_tasks).include?(rt) ?
|
79
|
+
"unless profile_stamp_exists?('#{profile_task_name}:#{rt}', '#{tsk[:name]}', '#{rt}') ; then
|
80
|
+
top.deprec.profiles.#{tsk[:name]}.#{rt}
|
81
|
+
profile_stamp('#{profile_task_name}:#{rt}', '#{tsk[:name]}', '#{rt}')
|
82
|
+
end
|
83
|
+
" : ""
|
84
|
+
end.join("\n")}\n
|
85
|
+
#{recipes.tasks_to_call.collect do |tsk|
|
86
|
+
(tsk[:args] || only_recipe_tasks).include?(rt) ?
|
87
|
+
"unless profile_stamp_exists?('#{profile_task_name}:#{rt}', '#{tsk[:name]}', '#{rt}') ; then
|
88
|
+
#{tsk[:literal] ? "top.deprec.#{tsk[:name]}" : "top.deprec.#{tsk[:name]}.#{rt}"}
|
89
|
+
profile_stamp('#{profile_task_name}:#{rt}', '#{tsk[:name]}', '#{rt}')
|
90
|
+
end
|
91
|
+
" : ""
|
92
|
+
end.join("\n")}\n
|
93
|
+
remove_profile_stamps('#{profile_task_name}:#{rt}')\nend\nend\nend\nend
|
94
|
+
"
|
95
|
+
puts cmd if ENV['DEBUG_PROFILES']
|
96
|
+
eval(cmd)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def profile_stamp(profile_name, executing_recipe, executing_task)
|
101
|
+
stamp_name = "stamp-#{profile_name.gsub(/:/, '_')}-#{executing_task_name(executing_recipe, executing_task)}"
|
102
|
+
run "mkdir -p ~/.deprec ; touch ~/.deprec/#{stamp_name}"
|
103
|
+
end
|
104
|
+
|
105
|
+
def profile_stamp_exists?(profile_name, executing_recipe, executing_task)
|
106
|
+
stamp_name = "stamp-#{profile_name.gsub(/:/, '_')}-#{executing_task_name(executing_recipe, executing_task)}"
|
107
|
+
result = nil
|
108
|
+
run "mkdir -p ~/.deprec ; test -e ~/.deprec/#{stamp_name} && echo OK || true" do |channel,stream,data|
|
109
|
+
result = (data.strip == "OK")
|
110
|
+
end
|
111
|
+
result
|
112
|
+
end
|
113
|
+
|
114
|
+
def remove_profile_stamps(profile_name)
|
115
|
+
run "mkdir -p ~/.deprec ; rm -f ~/.deprec/stamp-#{profile_name.gsub(/:/, '_')}-*"
|
116
|
+
end
|
117
|
+
|
118
|
+
def executing_task_name(executing_recipe, executing_task)
|
119
|
+
if executing_recipe =~ /\./
|
120
|
+
"#{executing_recipe.gsub(/\./, '_')}--#{executing_task}"
|
121
|
+
else
|
122
|
+
"#{executing_recipe}_#{executing_task}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|