Empact-deprec 1.99.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/CHANGELOG +170 -0
  2. data/COPYING +19 -0
  3. data/LICENSE +339 -0
  4. data/README +136 -0
  5. data/THANKS +5 -0
  6. data/bin/depify +133 -0
  7. data/docs/ANNOUNCE.deprec2 +47 -0
  8. data/docs/README.install +88 -0
  9. data/docs/README.nagios +28 -0
  10. data/docs/README.rails +20 -0
  11. data/docs/README.svn +31 -0
  12. data/docs/ROADMAP.txt +74 -0
  13. data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
  14. data/docs/deprec-1.x/notes.txt +12 -0
  15. data/docs/deprec_banner.gif +0 -0
  16. data/lib/deprec.rb +8 -0
  17. data/lib/deprec/capistrano_extensions.rb +378 -0
  18. data/lib/deprec/recipes.rb +40 -0
  19. data/lib/deprec/recipes/aoe.rb +117 -0
  20. data/lib/deprec/recipes/apache.rb +179 -0
  21. data/lib/deprec/recipes/ar_sendmail.rb +65 -0
  22. data/lib/deprec/recipes/canonical.rb +57 -0
  23. data/lib/deprec/recipes/deprec.rb +155 -0
  24. data/lib/deprec/recipes/deprecated.rb +71 -0
  25. data/lib/deprec/recipes/example.rb +115 -0
  26. data/lib/deprec/recipes/git.rb +168 -0
  27. data/lib/deprec/recipes/gitosis.rb +47 -0
  28. data/lib/deprec/recipes/god.rb +107 -0
  29. data/lib/deprec/recipes/heartbeat.rb +138 -0
  30. data/lib/deprec/recipes/iptables.rb +53 -0
  31. data/lib/deprec/recipes/logrotate.rb +51 -0
  32. data/lib/deprec/recipes/lvm.rb +20 -0
  33. data/lib/deprec/recipes/memcached.rb +102 -0
  34. data/lib/deprec/recipes/mongrel.rb +209 -0
  35. data/lib/deprec/recipes/monit.rb +130 -0
  36. data/lib/deprec/recipes/mysql.rb +115 -0
  37. data/lib/deprec/recipes/nagios.rb +302 -0
  38. data/lib/deprec/recipes/network.rb +84 -0
  39. data/lib/deprec/recipes/nginx.rb +154 -0
  40. data/lib/deprec/recipes/ntp.rb +96 -0
  41. data/lib/deprec/recipes/php.rb +99 -0
  42. data/lib/deprec/recipes/postfix.rb +105 -0
  43. data/lib/deprec/recipes/rails.rb +302 -0
  44. data/lib/deprec/recipes/ruby.rb +66 -0
  45. data/lib/deprec/recipes/sphinx.rb +83 -0
  46. data/lib/deprec/recipes/ssh.rb +93 -0
  47. data/lib/deprec/recipes/svn.rb +169 -0
  48. data/lib/deprec/recipes/swiftiply.rb +108 -0
  49. data/lib/deprec/recipes/thin.rb +201 -0
  50. data/lib/deprec/recipes/trac.rb +277 -0
  51. data/lib/deprec/recipes/ubuntu.rb +20 -0
  52. data/lib/deprec/recipes/users.rb +90 -0
  53. data/lib/deprec/recipes/utils.rb +39 -0
  54. data/lib/deprec/recipes/xen.rb +259 -0
  55. data/lib/deprec/templates/aoe/aoe-init +55 -0
  56. data/lib/deprec/templates/aoe/fence_aoemask +351 -0
  57. data/lib/deprec/templates/apache/httpd-vhost-app.conf.erb +144 -0
  58. data/lib/deprec/templates/apache/httpd.conf +465 -0
  59. data/lib/deprec/templates/apache/index.html.erb +37 -0
  60. data/lib/deprec/templates/apache/master.css +72 -0
  61. data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
  62. data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
  63. data/lib/deprec/templates/coraid/aoe-init +55 -0
  64. data/lib/deprec/templates/deprec/caprc.erb +14 -0
  65. data/lib/deprec/templates/god/god-init-script +71 -0
  66. data/lib/deprec/templates/god/god-notifications +0 -0
  67. data/lib/deprec/templates/god/god_mongrel.erb +81 -0
  68. data/lib/deprec/templates/god/god_mysql.erb +50 -0
  69. data/lib/deprec/templates/god/god_nginx.erb +61 -0
  70. data/lib/deprec/templates/god/god_thin.erb +80 -0
  71. data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
  72. data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
  73. data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
  74. data/lib/deprec/templates/iptables/iptables.up.erb +41 -0
  75. data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
  76. data/lib/deprec/templates/memcached/memcached-init-script +65 -0
  77. data/lib/deprec/templates/memcached/memcached.conf.erb +46 -0
  78. data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
  79. data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
  80. data/lib/deprec/templates/mongrel/mongrel_cluster.logrotate.d +14 -0
  81. data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  82. data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
  83. data/lib/deprec/templates/monit/monit-init-script +104 -0
  84. data/lib/deprec/templates/monit/monitrc.erb +227 -0
  85. data/lib/deprec/templates/monit/nothing +0 -0
  86. data/lib/deprec/templates/mysql/create_databases.sql +20 -0
  87. data/lib/deprec/templates/mysql/database.yml.prod +6 -0
  88. data/lib/deprec/templates/mysql/database.yml.stage +6 -0
  89. data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
  90. data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
  91. data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
  92. data/lib/deprec/templates/nagios/cgi.cfg.erb +321 -0
  93. data/lib/deprec/templates/nagios/commands.cfg.erb +240 -0
  94. data/lib/deprec/templates/nagios/contacts.cfg.erb +75 -0
  95. data/lib/deprec/templates/nagios/hosts.cfg.erb +70 -0
  96. data/lib/deprec/templates/nagios/htpasswd.users +1 -0
  97. data/lib/deprec/templates/nagios/localhost.cfg.erb +157 -0
  98. data/lib/deprec/templates/nagios/nagios.cfg.erb +1274 -0
  99. data/lib/deprec/templates/nagios/nagios_apache_vhost.conf.erb +45 -0
  100. data/lib/deprec/templates/nagios/nrpe.cfg.erb +208 -0
  101. data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
  102. data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
  103. data/lib/deprec/templates/nagios/services.cfg.erb +7 -0
  104. data/lib/deprec/templates/nagios/templates.cfg.erb +190 -0
  105. data/lib/deprec/templates/nagios/timeperiods.cfg.erb +94 -0
  106. data/lib/deprec/templates/network/hostname.erb +1 -0
  107. data/lib/deprec/templates/network/hosts.erb +2 -0
  108. data/lib/deprec/templates/network/interfaces.erb +18 -0
  109. data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
  110. data/lib/deprec/templates/nginx/mime.types.erb +70 -0
  111. data/lib/deprec/templates/nginx/nginx-init-script +62 -0
  112. data/lib/deprec/templates/nginx/nginx.conf.erb +53 -0
  113. data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
  114. data/lib/deprec/templates/nginx/nothing.conf +1 -0
  115. data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +45 -0
  116. data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
  117. data/lib/deprec/templates/postfix/aliases.erb +3 -0
  118. data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
  119. data/lib/deprec/templates/postfix/main.cf.erb +41 -0
  120. data/lib/deprec/templates/postfix/master.cf.erb +77 -0
  121. data/lib/deprec/templates/rails/database.yml.erb +6 -0
  122. data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
  123. data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
  124. data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
  125. data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
  126. data/lib/deprec/templates/swiftiply/swiftiply-init-script +61 -0
  127. data/lib/deprec/templates/swiftiply/swiftiply.yml.erb +11 -0
  128. data/lib/deprec/templates/thin/thin-init-script +51 -0
  129. data/lib/deprec/templates/thin/thin.yml.erb +11 -0
  130. data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
  131. data/lib/deprec/templates/trac/nginx_vhost.conf.erb +26 -0
  132. data/lib/deprec/templates/trac/trac.ini.erb +169 -0
  133. data/lib/deprec/templates/trac/trac_deprec.png +0 -0
  134. data/lib/deprec/templates/trac/tracd-init.erb +43 -0
  135. data/lib/deprec/templates/trac/users.htdigest.erb +0 -0
  136. data/lib/deprec/templates/xen/15-disable-hwclock +40 -0
  137. data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
  138. data/lib/deprec/templates/xen/xen-tools.conf.erb +220 -0
  139. data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
  140. data/lib/deprec/templates/xen/xend-init.erb +69 -0
  141. data/lib/deprec/templates/xen/xendomains.erb +137 -0
  142. data/lib/deprec/templates/xen/xm.tmpl.erb +85 -0
  143. data/lib/vmbuilder_plugins/all.rb +20 -0
  144. data/lib/vmbuilder_plugins/apt.rb +93 -0
  145. data/lib/vmbuilder_plugins/emerge.rb +76 -0
  146. data/lib/vmbuilder_plugins/gem.rb +90 -0
  147. data/lib/vmbuilder_plugins/std.rb +203 -0
  148. metadata +207 -0
@@ -0,0 +1,20 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :ubuntu do
5
+
6
+ task :update do
7
+ apt.update
8
+ end
9
+
10
+ task :upgrade do
11
+ apt.upgrade
12
+ end
13
+
14
+ task :restart do
15
+ sudo "reboot"
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,90 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :users do
5
+
6
+ # desc "Create user account"
7
+ # task :add do
8
+ # target_user = Capistrano::CLI.ui.ask "Enter userid for new user" do |q|
9
+ # q.default = user
10
+ # end
11
+ # deprec2.useradd(target_user, :shell => '/bin/bash')
12
+ # puts "Setting password for new account"
13
+ # deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/)
14
+ # end
15
+
16
+ desc "Create account"
17
+ task :add do
18
+ target_user = Capistrano::CLI.ui.ask "Enter userid for new user" do |q|
19
+ q.default = user
20
+ end
21
+ make_admin = Capistrano::CLI.ui.ask "Should this be an admin account?" do |q|
22
+ q.default = 'no'
23
+ end
24
+ copy_keys = false
25
+ if File.readable?("config/ssh/authorized_keys/#{target_user}")
26
+ copy_keys = Capistrano::CLI.ui.ask "I've found an authorized_keys file for #{target_user}. Should I copy it out?" do |q|
27
+ q.default = 'yes'
28
+ end
29
+ end
30
+
31
+ new_password = Capistrano::CLI.ui.ask("Enter new password for #{target_user}") { |q| q.echo = false }
32
+
33
+ deprec2.useradd(target_user, :shell => '/bin/bash')
34
+
35
+ deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/, new_password)
36
+
37
+ if make_admin.grep(/y/i)
38
+ deprec2.groupadd('admin')
39
+ deprec2.add_user_to_group(target_user, 'admin')
40
+ deprec2.append_to_file_if_missing('/etc/sudoers', '%admin ALL=(ALL) ALL')
41
+ end
42
+
43
+ if copy_keys && copy_keys.grep(/y/i)
44
+ set :target_user, target_user
45
+ top.deprec.ssh.setup_keys
46
+ end
47
+
48
+ end
49
+
50
+ desc "Create account"
51
+ task :add_admin do
52
+ puts 'deprecated! use deprec:users:add'
53
+ add
54
+ end
55
+
56
+ desc "Change user password"
57
+ task :passwd do
58
+ target_user = Capistrano::CLI.ui.ask "Enter user to change password for" do |q|
59
+ q.default = user if user.is_a?(String)
60
+ end
61
+ new_password = Capistrano::CLI.ui.ask("Enter new password for #{target_user}") { |q| q.echo = false }
62
+
63
+ deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/, new_password)
64
+ end
65
+
66
+ desc "Add user to group"
67
+ task :add_user_to_group do
68
+ target_user = Capistrano::CLI.ui.ask "Which user?" do |q|
69
+ q.default = user if user.is_a?(String)
70
+ end
71
+ target_group = Capistrano::CLI.ui.ask "Add to which group?" do |q|
72
+ q.default = 'deploy'
73
+ end
74
+ deprec2.add_user_to_group(target_user, target_group)
75
+ end
76
+
77
+ # desc "Create group"
78
+ # task :add_group do
79
+ # target_group = Capistrano::CLI.ui.ask "Enter name for new group"
80
+ # deprec2.groupadd(target_group)
81
+ # end
82
+ #
83
+ # desc "Add user to group"
84
+ # task :add_user_to_group do
85
+ # # XXX not yet implemented
86
+ # end
87
+
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,39 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :utils do
5
+
6
+ SRC_PACKAGES[:daemonize] = {
7
+ :filename => 'daemonize-1.5.2.tar.gz',
8
+ :md5sum => "c016f1a17f03ec976873d0a283a1a038 daemonize-1.5.2.tar.gz",
9
+ :dir => 'daemonize-1.5.2',
10
+ :url => "http://www.clapper.org/software/daemonize/daemonize-1.5.2.tar.gz",
11
+ :unpack => "tar zxf daemonize-1.5.2.tar.gz;",
12
+ :configure => %w(
13
+ ./configure
14
+ ;
15
+ ).reject{|arg| arg.match '#'}.join(' '),
16
+ :make => 'make;',
17
+ :install => 'make install;'
18
+ }
19
+
20
+ namespace :daemonize do
21
+
22
+ desc "Install daemonize"
23
+ task :install do
24
+ deprec2.download_src(SRC_PACKAGES[:daemonize], src_dir)
25
+ deprec2.install_from_src(SRC_PACKAGES[:daemonize], src_dir)
26
+ end
27
+
28
+ end
29
+
30
+ task :net do
31
+ apps = %w(lynx nmap netcat
32
+ vim-full)
33
+ apt.install( {:base => apps}, :stable )
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+
@@ -0,0 +1,259 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :xen do
5
+
6
+ # Config variables for migration
7
+ default(:xen_slice) { Capistrano::CLI.ui.ask("Slice name") }
8
+ default(:xen_old_host) { Capistrano::CLI.ui.ask("Old Xen host") }
9
+ default(:xen_new_host) { Capistrano::CLI.ui.ask("New Xen host") }
10
+ set(:xen_disk_size) { Capistrano::CLI.ui.ask("Disk size (GB)") }
11
+ set(:xen_swap_size) { Capistrano::CLI.ui.ask("Swap size (GB)") }
12
+
13
+ # ref: http://www.eadz.co.nz/blog/article/xen-gutsy.html
14
+
15
+ SYSTEM_CONFIG_FILES[:xen] = [
16
+
17
+ {:template => "xend-config.sxp.erb",
18
+ :path => '/etc/xen/xend-config.sxp',
19
+ :mode => 0644,
20
+ :owner => 'root:root'},
21
+
22
+ {:template => "xen-tools.conf.erb",
23
+ :path => '/etc/xen-tools/xen-tools.conf',
24
+ :mode => 0644,
25
+ :owner => 'root:root'},
26
+
27
+ {:template => "xm.tmpl.erb",
28
+ :path => '/etc/xen-tools/xm.tmpl',
29
+ :mode => 0644,
30
+ :owner => 'root:root'},
31
+
32
+ {:template => "xendomains.erb",
33
+ :path => '/etc/default/xendomains',
34
+ :mode => 0755,
35
+ :owner => 'root:root'},
36
+
37
+ # This one is a bugfix for gutsy
38
+ {:template => "15-disable-hwclock",
39
+ :path => '/usr/lib/xen-tools/gutsy.d/15-disable-hwclock',
40
+ :mode => 0755,
41
+ :owner => 'root:root'},
42
+
43
+ # So is this - xendomains fails to shut down domains on system shutdown
44
+ {:template => "xend-init.erb",
45
+ :path => '/etc/init.d/xend',
46
+ :mode => 0755,
47
+ :owner => 'root:root'},
48
+
49
+ # This gives you a second network bridge on second ethernet device
50
+ {:template => "network-bridge-wrapper",
51
+ :path => '/etc/xen/scripts/network-bridge-wrapper',
52
+ :mode => 0755,
53
+ :owner => 'root:root'}
54
+
55
+ ]
56
+
57
+ desc "Install Xen"
58
+ task :install, :roles => :dom0 do
59
+ install_deps
60
+ # it's all in deps baby
61
+ end
62
+
63
+ task :install_deps do
64
+ # for amd64 version of ubuntu 7.10
65
+ apt.install( {:base => %w(linux-image-xen bridge-utils libxen3.1 python-xen-3.1 xen-docs-3.1 xen-hypervisor-3.1 xen-ioemu-3.1 xen-tools xen-utils-3.1 lvm2)}, :stable )
66
+ # alternatively, for x86 version of ubuntu:
67
+ # apt-get install ubuntu-xen-server libc6-xen
68
+ end
69
+
70
+ desc "Generate configuration file(s) for Xen from template(s)"
71
+ task :config_gen do
72
+ SYSTEM_CONFIG_FILES[:xen].each do |file|
73
+ deprec2.render_template(:xen, file)
74
+ end
75
+ end
76
+
77
+ desc "Push Xen config files to server"
78
+ task :config do
79
+ deprec2.push_configs(:xen, SYSTEM_CONFIG_FILES[:xen])
80
+ end
81
+
82
+ # Create new virtual machine
83
+ # xen-create-image --force --ip=192.168.1.31 --hostname=x1 --mac=00:16:3E:11:12:31
84
+
85
+ # Start a virtual image (and open console to it)
86
+ # xm create -c /etc/xen/x1.cfg
87
+
88
+ desc "Start Xen"
89
+ task :start do
90
+ send(run_method, "/etc/init.d/xend start")
91
+ end
92
+
93
+ desc "Stop Xen"
94
+ task :stop do
95
+ send(run_method, "/etc/init.d/xend stop")
96
+ end
97
+
98
+ desc "Restart Xen"
99
+ task :restart do
100
+ send(run_method, "/etc/init.d/xend restart")
101
+ end
102
+
103
+ desc "Reload Xen"
104
+ task :reload do
105
+ send(run_method, "/etc/init.d/xend reload")
106
+ end
107
+
108
+ task :list do
109
+ sudo "xm list"
110
+ end
111
+
112
+ task :info do
113
+ sudo "xm info"
114
+ end
115
+
116
+ desc "Migrate a slice on one Xen host to another. Slice is stopped, disk is tar'd up and transferred to new host."
117
+ task :migrate do
118
+
119
+ # Get user input for these values
120
+ xen_old_host && xen_new_host && xen_disk_size && xen_swap_size && xen_slice
121
+
122
+ copy_disk
123
+ copy_slice_config
124
+ create_lvm_disks
125
+ build_slice_from_tarball
126
+ end
127
+
128
+
129
+ task :copy_disk do
130
+ mnt_dir = "/mnt/#{xen_slice}-disk"
131
+ tarball = "/tmp/#{xen_slice}-disk.tar"
132
+ lvm_disk = "/dev/vm_local/#{xen_slice}-disk"
133
+
134
+ # Shutdown slice
135
+ sudo "xm list | grep #{xen_slice} && xm shutdown #{xen_slice} && sleep 10; exit 0", :hosts => xen_old_host
136
+
137
+ # Tar up disk partition
138
+ sudo "test -d #{mnt_dir} || #{sudo} mkdir #{mnt_dir}; exit 0", :hosts => xen_old_host
139
+ sudo "mount | grep #{mnt_dir} || #{sudo} mount -t auto #{lvm_disk} #{mnt_dir}; exit 0", :hosts => xen_old_host
140
+ sudo "sh -c 'cd #{mnt_dir} && tar cfp #{tarball} *'", :hosts => xen_old_host
141
+ sudo "umount #{mnt_dir}", :hosts => xen_old_host
142
+ sudo "rmdir #{mnt_dir}", :hosts => xen_old_host
143
+
144
+ # start slice again if necessary
145
+ # xm create ${SLICE}.cfg
146
+
147
+ # copy to other server
148
+ run "scp #{tarball} #{xen_new_host}:/tmp/", :hosts => xen_old_host
149
+
150
+ # clean up tarball
151
+ sudo "rm #{tarball}", :hosts => xen_old_host
152
+ end
153
+
154
+ task :copy_slice_config do
155
+ run "scp /etc/xen/#{xen_slice}.cfg #{xen_new_host}:", :hosts => xen_old_host
156
+ sudo "test -f /etc/xen/#{xen_slice}.cfg || #{sudo} mv #{xen_slice}.cfg /etc/xen/", :hosts => xen_new_host
157
+ end
158
+
159
+ task :create_lvm_disks do
160
+ xen_new_host
161
+ # create lvm disks on new host
162
+ disks = {"#{xen_slice}-disk" => xen_disk_size, "#{xen_slice}-swap" => xen_swap_size}
163
+ disks.each { |disk, size|
164
+ puts "Creating #{disk} (#{size} GB)"
165
+ sudo "lvcreate -L #{size}G -n #{disk} vm_local", :hosts => xen_new_host
166
+ sudo "mkfs.ext3 /dev/vm_local/#{disk}", :hosts => xen_new_host
167
+ }
168
+ end
169
+
170
+ task :build_slice_from_tarball do
171
+ mnt_dir = "/mnt/#{xen_slice}-disk"
172
+ tarball = "/tmp/#{xen_slice}-disk.tar"
173
+ lvm_disk = "/dev/vm_local/#{xen_slice}-disk"
174
+
175
+ # untar archive into lvm disk
176
+ sudo "test -d #{mnt_dir} || #{sudo} mkdir #{mnt_dir}; exit 0", :hosts => xen_new_host
177
+ sudo "mount | grep #{mnt_dir} || #{sudo} mount -t auto #{lvm_disk} #{mnt_dir}; exit 0", :hosts => xen_new_host
178
+ sudo "sh -c 'cd #{mnt_dir} && tar xf #{tarball}'", :hosts => xen_new_host
179
+ sudo "umount #{mnt_dir}", :hosts => xen_new_host
180
+ sudo "rmdir #{mnt_dir}", :hosts => xen_new_host
181
+ end
182
+
183
+
184
+
185
+ end
186
+ end
187
+ end
188
+
189
+ # Stop the 'incrementing ethX problem'
190
+ #
191
+ # Ubuntu stores the MAC addresses of the NICs it sees. If you change an ethernet card (real or virtual)
192
+ # it will assign is a new ethX address. That's why you'll sometimes find eth2 but no eth1.
193
+ # Your domU's should have a MAC address assigned in their config file but if you come across this problem,
194
+ # fix it with this:
195
+ #
196
+ # sudo rm /etc/udev/rules.d/70-persistent-net.rules
197
+
198
+
199
+
200
+ # ubuntu bugs
201
+ #
202
+ # check if they're fixed in hardy heron
203
+
204
+ # 1: domains are not shut down on system shutdown
205
+ # cause: order that init scripts get called
206
+ # fix: call /etc/init.d/xendomains from /etc/init.d/xend script
207
+
208
+ # stop)
209
+ # /etc/init.d/xendomains stop # make sure domains are shut down
210
+ # xend stop
211
+ # ;;
212
+
213
+ # virtsh
214
+ #
215
+ # enable by putting this into /etc/xen/xend-conf.sxp
216
+ # (xend-unix-server yes)
217
+
218
+
219
+
220
+ #
221
+ # Install xen on ubuntu hardy
222
+ #
223
+ # ref: http://www.howtoforge.com/ubuntu-8.04-server-install-xen-from-ubuntu-repositories
224
+ #
225
+
226
+
227
+ # Install Xen packages
228
+ # apt-get install ubuntu-xen-server
229
+ #
230
+ # Installs these:
231
+ #
232
+ # binutils binutils-static bridge-utils debootstrap libasound2 libconfig-inifiles-perl libcurl3 libdirectfb-1.0-0 libsdl1.2debian
233
+ # libsdl1.2debian-alsa libtext-template-perl libxen3 libxml2 linux-image-2.6.24-16-xen linux-image-xen
234
+ # linux-restricted-modules-2.6.24-16-xen linux-restricted-modules-common linux-restricted-modules-xen
235
+ # linux-ubuntu-modules-2.6.24-16-xen linux-xen nvidia-kernel-common python-dev python-xen-3.2 python2.5-dev ubuntu-xen-server
236
+ # xen-docs-3.2 xen-hypervisor-3.2 xen-tools xen-utils-3.2
237
+
238
+ # before/after 'uname -a'
239
+ #
240
+ # Linux bb 2.6.24-16-server #1 SMP Thu Apr 10 13:15:38 UTC 2008 x86_64 GNU/Linux
241
+ # Linux bb 2.6.24-16-xen #1 SMP Thu Apr 10 14:35:03 UTC 2008 x86_64 GNU/Linux
242
+ #
243
+ # Stop apparmor # XXX investigate why
244
+ # /etc/init.d/apparmor stop
245
+ # update-rc.d -f apparmor remove
246
+
247
+ # mkdir /home/xen
248
+
249
+ # edit /etc/xen-tools/xen-tools.cfg
250
+
251
+ # create image with xen-tools
252
+ # xen-create-image --hostname=x1 --size=2Gb --swap=256Mb --ide --ip=192.168.1.51 --memory=256Mb --install-method=debootstrap --dist=hardy
253
+
254
+ # update /etc/xen/<domain>.cfg
255
+ #
256
+ # disk = [
257
+ # 'tap:aio:/home/xen/domains/xen1.example.com/swap.img,hda1,w',
258
+ # 'tap:aio:/home/xen/domains/xen1.example.com/disk.img,hda2,w',
259
+ # ]
@@ -0,0 +1,55 @@
1
+ #! /bin/sh
2
+ # aoe-init - example init script for ATA over Ethernet storage
3
+ #
4
+ # Edit this script for your purposes. (Changing "eth1" to the
5
+ # appropriate interface name, adding commands, etc.) You might
6
+ # need to tune the sleep times.
7
+ #
8
+ # Install this script in /etc/init.d with the other init scripts.
9
+ #
10
+ # Make it executable:
11
+ # chmod 755 /etc/init.d/aoe-init
12
+ #
13
+ # Install symlinks for boot time:
14
+ # cd /etc/rc3.d && ln -s ../init.d/aoe-init S99aoe-init
15
+ # cd /etc/rc5.d && ln -s ../init.d/aoe-init S99aoe-init
16
+ #
17
+ # Install symlinks for shutdown time:
18
+ # cd /etc/rc0.d && ln -s ../init.d/aoe-init K01aoe-init
19
+ # cd /etc/rc1.d && ln -s ../init.d/aoe-init K01aoe-init
20
+ # cd /etc/rc2.d && ln -s ../init.d/aoe-init K01aoe-init
21
+ # cd /etc/rc6.d && ln -s ../init.d/aoe-init K01aoe-init
22
+ #
23
+
24
+ case "$1" in
25
+ "start")
26
+ # load any needed network drivers here
27
+
28
+ # replace "eth1" with your aoe network interface
29
+ ifconfig eth1 up
30
+
31
+ # time for network interface to come up
32
+ sleep 4
33
+
34
+ modprobe aoe
35
+
36
+ # time for AoE discovery and udev
37
+ sleep 7
38
+
39
+ # add your raid assemble commands here
40
+ # add any LVM commands if needed (e.g. vgchange)
41
+ # add your filesystem mount commands here
42
+
43
+ test -d /var/lock/subsys && touch /var/lock/subsys/aoe-init
44
+ ;;
45
+ "stop")
46
+ # add your filesystem umount commands here
47
+ # deactivate LVM volume groups if needed
48
+ # add your raid stop commands here
49
+ rmmod aoe
50
+ rm -f /var/lock/subsys/aoe-init
51
+ ;;
52
+ *)
53
+ echo "usage: `basename $0` {start|stop}" 1>&2
54
+ ;;
55
+ esac