le1t0-deprec 2.1.6.057 → 2.1.6.058

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/lib/deprec/recipes/app/passenger.rb +70 -18
  2. data/lib/deprec/recipes/iptables.rb +8 -9
  3. data/lib/deprec/recipes/profiles.rb +84 -0
  4. data/lib/deprec/recipes/redis.rb +2 -7
  5. data/lib/deprec/recipes/ruby/rvm.rb +75 -0
  6. data/lib/deprec/recipes/sphinx/thinking_sphinx.rb +3 -3
  7. data/lib/deprec/recipes/sphinx/ultrasphinx.rb +3 -3
  8. data/lib/deprec/recipes/syslog/syslog_ng.rb +6 -6
  9. data/lib/deprec/recipes/ubuntu.rb +35 -0
  10. data/lib/deprec/recipes/xen.rb +97 -29
  11. data/lib/deprec/recipes/xentools.rb +97 -58
  12. data/lib/deprec/templates/iptables/firewall-init.erb +141 -175
  13. data/lib/deprec/templates/passenger/passenger.conf.erb +1 -1
  14. data/lib/deprec/templates/redis/redis-conf.erb +225 -45
  15. data/lib/deprec/templates/ubuntu/getlibs.erb +599 -0
  16. data/lib/deprec/templates/xentools/{98-custom → 01-mount-devpts.erb} +2 -5
  17. data/lib/deprec/templates/xentools/98-custom.erb +42 -0
  18. data/lib/deprec/templates/xentools/99-devpts-umount.erb +14 -0
  19. data/lib/deprec/templates/xentools/kernel-img.conf.example.erb +10 -0
  20. data/lib/deprec/templates/xentools/update-grub-xenu.example.erb +4 -0
  21. data/lib/deprec/templates/xentools/xm.tmpl.erb +20 -48
  22. data/lib/deprec.rb +15 -1
  23. metadata +18 -13
  24. data/lib/deprec/recipes/rvm.rb +0 -32
  25. data/lib/deprec/templates/iptables/firewall-default.erb +0 -13
  26. data/lib/deprec/templates/xentools/100-ubuntu-setup +0 -26
  27. data/lib/deprec/templates/xentools/15-disable-hwclock +0 -40
  28. data/lib/deprec/templates/xentools/30-disable-gettys +0 -57
  29. data/lib/deprec/templates/xentools/31-ubuntu-setup +0 -32
  30. data/lib/deprec/templates/xentools/40-setup-networking +0 -145
  31. data/lib/deprec/templates/xentools/xen-tools.conf.erb +0 -278
@@ -5,12 +5,24 @@ Capistrano::Configuration.instance(:must_exist).load do
5
5
 
6
6
  set(:passenger_install_dir) {
7
7
  if ruby_choice == :ree
8
- base_dir = "#{ree_install_dir}/lib/ruby/gems/1.8/gems/"
9
- latest_passenger_version = capture("ls -d #{base_dir + 'passenger-*'} | tail -1").chomp
8
+ "#{ree_install_dir}/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}"
9
+ elsif ruby_choice == :rvm && (rvm_default_ruby || 'custom').to_sym != :system
10
+ ruby_dir = capture("rvm info homes").split("\n").grep(/^\s*gem:/).first.split(/\s/).select { |x| !x.empty? && x != "gem:" }.first.gsub(/\"/, '')
11
+ "#{ruby_dir}/gems/passenger-#{passenger_version}"
10
12
  else
11
13
  "/usr/local/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}"
12
14
  end
13
15
  }
16
+
17
+ set(:passenger_ruby) {
18
+ if ruby_choice == :ree
19
+ "#{ree_install_dir}/bin/ruby"
20
+ elsif ruby_choice == :rvm
21
+ rvm_default_ruby.to_sym == :system ? "/usr/local/bin/passenger_ruby" : File.join(capture("pwd").chomp, '.rvm', 'bin', 'passenger_ruby')
22
+ else
23
+ "/usr/local/bin/ruby"
24
+ end
25
+ }
14
26
 
15
27
  set(:passenger_document_root) { "#{current_path}/public" }
16
28
  set :passenger_rails_allow_mod_rewrite, 'off'
@@ -35,24 +47,33 @@ Capistrano::Configuration.instance(:must_exist).load do
35
47
  set :passenger_app_root, nil # set to a string to set an explicit path, set to false to disable the setting,
36
48
  # defaults to parent dir of :passenger_document_root
37
49
 
50
+ set :passenger_disable_modules, []
51
+ set :passenger_enable_modules, []
52
+ set :passenger_disable_sites, []
53
+ set :passenger_extra_vhosts, {} # key should be name of file in /etc/apache2/sites-available, value should be contents
54
+
38
55
  desc "Install passenger"
39
- task :install, :roles => :app do
56
+ task :install, :roles => :passenger do
40
57
  install_deps
41
58
  gem2.install 'passenger', passenger_version
42
- sudo "passenger-install-apache2-module -a"
59
+ if ruby_choice == :rvm
60
+ run "rvmsudo passenger-install-apache2-module -a"
61
+ else
62
+ sudo "passenger-install-apache2-module -a"
63
+ end
43
64
  initial_config_push
44
65
  activate_system
45
66
  end
46
67
 
47
68
  # Install dependencies for Passenger
48
- task :install_deps, :roles => :app do
69
+ task :install_deps, :roles => :passenger do
49
70
  apt.install( {:base => %w(apache2-mpm-prefork apache2-prefork-dev rsync)}, :stable )
50
71
  gem2.install 'fastthread'
51
72
  gem2.install 'rack'
52
73
  gem2.install 'rake'
53
74
  end
54
75
 
55
- task :initial_config_push, :roles => :web do
76
+ task :initial_config_push, :roles => :passenger do
56
77
  # XXX Non-standard!
57
78
  # We need to push out the .load and .conf files for Passenger
58
79
  SYSTEM_CONFIG_FILES[:passenger].each do |file|
@@ -109,48 +130,79 @@ Capistrano::Configuration.instance(:must_exist).load do
109
130
  end
110
131
 
111
132
  desc "Push Passenger config files (system & project level) to server"
112
- task :config, :roles => :app do
133
+ task :config, :roles => :passenger do
113
134
  config_system
114
135
  config_project
115
136
  end
116
137
 
117
138
  desc "Push Passenger configs (system level) to server"
118
- task :config_system, :roles => :app do
139
+ task :config_system, :roles => :passenger do
119
140
  deprec2.push_configs(:passenger, SYSTEM_CONFIG_FILES[:passenger])
141
+ symlink_extra_apache_vhosts
142
+ disable_modules
143
+ enable_modules
144
+ disable_sites
120
145
  activate_system
121
146
  end
122
147
 
123
148
  desc "Push Passenger configs (project level) to server"
124
- task :config_project, :roles => :app do
149
+ task :config_project, :roles => :passenger do
125
150
  deprec2.push_configs(:passenger, PROJECT_CONFIG_FILES[:passenger])
126
151
  symlink_apache_vhost
127
152
  activate_project
128
153
  symlink_logrotate_config
129
154
  end
130
155
 
131
- task :symlink_logrotate_config, :roles => :app do
156
+ task :symlink_logrotate_config, :roles => :passenger do
132
157
  sudo "ln -sf #{deploy_to}/passenger/logrotate.conf /etc/logrotate.d/passenger-#{application}"
133
158
  end
134
159
 
135
160
  # Passenger runs Rails as the owner of this file.
136
- task :set_owner_of_environment_rb, :roles => :app do
161
+ task :set_owner_of_environment_rb, :roles => :passenger do
137
162
  sudo "chown #{app_user} #{current_path}/config/environment.rb"
138
163
  end
139
164
 
140
- task :symlink_apache_vhost, :roles => :app do
165
+ task :symlink_apache_vhost, :roles => :passenger do
141
166
  sudo "ln -sf #{deploy_to}/passenger/apache_vhost #{apache_vhost_dir}/#{application}"
142
167
  end
143
168
 
144
- task :activate, :roles => :app do
169
+ task :symlink_extra_apache_vhosts, :roles => :passenger do
170
+ passenger_extra_vhosts.each do |name, vhost|
171
+ put vhost, tmp_file = "/tmp/apache_default_vhost_#{Time.now.strftime("%Y%m%d%H%M%S")}.txt", :mode => 0644
172
+ sudo "chown root:root #{tmp_file}"
173
+ sudo "mv #{tmp_file} /etc/apache2/sites-available/#{name}"
174
+ sudo "a2ensite #{name}"
175
+ end
176
+ end
177
+
178
+ task :disable_modules, :roles => :passenger do
179
+ passenger_disable_modules.each do |apache_module|
180
+ sudo "a2dismod #{apache_module}"
181
+ end
182
+ end
183
+
184
+ task :enable_modules, :roles => :passenger do
185
+ passenger_enable_modules.each do |apache_module|
186
+ sudo "a2enmod #{apache_module}"
187
+ end
188
+ end
189
+
190
+ task :disable_sites, :roles => :passenger do
191
+ passenger_disable_sites.each do |apache_vhost|
192
+ sudo "a2dissite #{apache_vhost}"
193
+ end
194
+ end
195
+
196
+ task :activate, :roles => :passenger do
145
197
  activate_system
146
198
  activate_project
147
199
  end
148
200
 
149
- task :activate_system, :roles => :app do
201
+ task :activate_system, :roles => :passenger do
150
202
  sudo "a2enmod passenger"
151
203
  end
152
204
 
153
- task :activate_project, :roles => :app do
205
+ task :activate_project, :roles => :passenger do
154
206
  sudo "a2ensite #{application}"
155
207
  end
156
208
 
@@ -170,16 +222,16 @@ Capistrano::Configuration.instance(:must_exist).load do
170
222
  puts
171
223
  end
172
224
 
173
- task :deactivate_system, :roles => :app do
225
+ task :deactivate_system, :roles => :passenger do
174
226
  sudo "a2dismod passenger"
175
227
  end
176
228
 
177
- task :deactivate_project, :roles => :app do
229
+ task :deactivate_project, :roles => :passenger do
178
230
  sudo "a2dissite #{application}"
179
231
  end
180
232
 
181
233
  desc "Restart Application"
182
- task :restart, :roles => :app do
234
+ task :restart, :roles => :passenger do
183
235
  run "#{sudo} touch #{current_path}/tmp/restart.txt"
184
236
  end
185
237
 
@@ -5,9 +5,15 @@ Capistrano::Configuration.instance(:must_exist).load do
5
5
 
6
6
  # see iptables-init script and iptables-default file for syntax
7
7
  set :iptables_allowed, "tcp:22,80,443"
8
+ set :iptables_drop, ""
9
+ set :iptables_reject, ""
8
10
  set :iptables_forwards, ""
11
+ set :iptables_rate_limits, ""
9
12
  set :iptables_binary, "/sbin/iptables"
10
13
  set :iptables_save_binary, "/sbin/iptables-save"
14
+ set :iptables_ipfrag_high_thresh, 262144
15
+ set :iptables_ipfrag_low_thresh, 196608
16
+ set :iptables_ipfrag_time, 30
11
17
 
12
18
  task :status do
13
19
  sudo "iptables -L -v"
@@ -27,10 +33,6 @@ Capistrano::Configuration.instance(:must_exist).load do
27
33
  {:template => 'firewall-init.erb',
28
34
  :path => '/etc/init.d/firewall',
29
35
  :mode => 0755,
30
- :owner => 'root:root'},
31
- {:template => 'firewall-default.erb',
32
- :path => '/etc/default/firewall',
33
- :mode => 0755,
34
36
  :owner => 'root:root'}
35
37
  ]
36
38
 
@@ -43,8 +45,7 @@ Capistrano::Configuration.instance(:must_exist).load do
43
45
 
44
46
  desc "Push iptables config files to server"
45
47
  task :config do
46
- sudo "test -e /etc/default/firewall && cp /etc/default/firewall /etc/default/firewall.bak || true"
47
- sudo "test -e /etc/init.d/firewall && cp /etc/init.d/firewall /etc/init.d/firewall.bak || true"
48
+ sudo "test -e /etc/init.d/firewall && sudo cp /etc/init.d/firewall /etc/init.d/firewall.bak || true"
48
49
  deprec2.push_configs(:iptables, SYSTEM_CONFIG_FILES[:iptables])
49
50
  deprec2.append_to_file_if_missing('/etc/services', 'vrrp 112/raw # vrrpd daemon')
50
51
  end
@@ -54,8 +55,7 @@ Capistrano::Configuration.instance(:must_exist).load do
54
55
  transaction do
55
56
  on_rollback {
56
57
  puts `git checkout config/#{stage}/iptables/etc`
57
- sudo "test -e /etc/default/firewall.bak && mv /etc/default/firewall.bak /etc/default/firewall || true"
58
- sudo "test -e /etc/init.d/firewall.bak && mv /etc/init.d/firewall.bak /etc/init.d/firewall || true"
58
+ sudo "test -e /etc/init.d/firewall.bak && sudo mv /etc/init.d/firewall.bak /etc/init.d/firewall || true"
59
59
  sudo "/etc/init.d/firewall start &"
60
60
  }
61
61
  config_gen
@@ -67,7 +67,6 @@ Capistrano::Configuration.instance(:must_exist).load do
67
67
 
68
68
  desc "Revert iptables config on server"
69
69
  task :revert do
70
- sudo "test -e /etc/default/firewall.bak && mv /etc/default/firewall.bak /etc/default/firewall || true"
71
70
  sudo "test -e /etc/init.d/firewall.bak && mv /etc/init.d/firewall.bak /etc/init.d/firewall || true"
72
71
  end
73
72
 
@@ -221,5 +221,89 @@ Capistrano::Configuration.instance(:must_exist).load do
221
221
  "#{executing_recipe}_#{executing_task}"
222
222
  end
223
223
  end
224
+
225
+ profile :rails_stack, :install do |p, r|
226
+ r.ruby
227
+ r.rails
228
+ r.svn
229
+ r.git
230
+ r.apache
231
+ r.passenger
232
+ r.s3utils
233
+ r.monit if use_monit
234
+ r.logrotate if use_logrotate
235
+ end
236
+
237
+ profile :ubuntu_base do |p, r|
238
+ r.call.ubuntu.remove_admin_group_from_users :config
239
+ r.iptables
240
+ r.postfix
241
+ r.ntp
242
+ r.ubuntu :install
243
+ r.nagios_plugins :install
244
+ r.ubuntu.utils.bash :config
245
+ r.syslog_ng
246
+ end
247
+
248
+ profile :app_base do |p, r|
249
+ p.ubuntu_base
250
+ p.rails_stack :install
251
+ r.imagemagick :install
252
+ r.aspell :install
253
+ r.sphinx :install
254
+ r.java
255
+ end
256
+
257
+ profile :app_server do |p, r|
258
+ p.app_base
259
+ r.god
260
+ r.call.passenger.config_gen_system :config_gen
261
+ r.glusterfs :install
262
+ r.call.glusterfs.config_client :config
263
+ r.call.glusterfs.activate_client :activate
264
+ r.call.glusterfs.start_client :start
265
+ r.call.haproxy.create_check_file :install
266
+ end
267
+
268
+ profile :db_server do |p, r|
269
+ p.app_base
270
+ r.mysql
271
+ r.keepalived
272
+ r.redis
273
+ end
274
+
275
+ profile :single_server do |p,r|
276
+ p.app_base
277
+ r.call.passenger.config_gen_system :config_gen
278
+ r.mysql
279
+ r.god
280
+ r.redis
281
+ end
282
+
283
+ profile :shared_server do |p, r|
284
+ p.ubuntu_base
285
+ r.keepalived
286
+ r.redis
287
+ r.glusterfs :install
288
+ r.call.glusterfs.config_server :config
289
+ r.call.glusterfs.activate_server :activate
290
+ r.call.glusterfs.start_server :start
291
+ end
292
+
293
+ profile :backups_server do |p, r|
294
+ p.ubuntu_base
295
+ p.rails_stack :install
296
+ end
297
+
298
+ profile :xen_server do |p, r|
299
+ p.ubuntu_base
300
+ r.haproxy
301
+ r.keepalived
302
+ r.apache
303
+ r.amcc_3ware :install
304
+ r.xentools :config_gen, :install, :config
305
+ r.call.xen.create_images :activate
306
+ r.call.xen.start_images :start
307
+ end
224
308
 
225
309
  end
@@ -7,14 +7,9 @@ Capistrano::Configuration.instance(:must_exist).load do
7
7
  set :redis_group, 'redis'
8
8
 
9
9
  SRC_PACKAGES[:redis] = {
10
- :md5sum => '0c5355e57606523f9e8ce816db5e542f redis-1.2.6.tar.gz',
11
- :filename => 'redis-1.2.6.tar.gz',
12
- :dir => 'redis-1.2.6',
13
- :url => "http://redis.googlecode.com/files/redis-1.2.6.tar.gz",
14
- :unpack => "tar zxf redis-1.2.6.tar.gz;",
15
- :make => 'make;',
10
+ :md5sum => '7799de79f36ebdb73bcb8f09816d1ac3 redis-2.0.3.tar.gz',
11
+ :url => "http://redis.googlecode.com/files/redis-2.0.3.tar.gz",
16
12
  :configure => nil,
17
- :install => "install -t /usr/local/bin redis-server redis-benchmark redis-cli redis-stat; install -o #{redis_user} -g #{redis_group} -d /var/lib/redis /var/log/redis"
18
13
  }
19
14
 
20
15
  desc "install Redis"
@@ -0,0 +1,75 @@
1
+ # Copyright 2010 by le1t0@github. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :rvm do
5
+
6
+ RVM_VERSION='1.0.1'
7
+
8
+ set :rvm_apt_packages, []
9
+ set :rvm_rubies, [] # First ruby will be set as default if rvm_default_ruby is nil or empty
10
+ set :rvm_default_ruby, nil
11
+ set :rvm_support_jruby, false
12
+ set :rvm_support_ree, false
13
+ set :rvm_support_mri, false
14
+ set :rvm_support_rbx, false
15
+ set :rvm_support_ironruby, false
16
+
17
+ desc "Install Rvm"
18
+ task :install do
19
+ install_deps
20
+ install_rvm = true
21
+ run "rvm --version | perl -n -e 'm/^rvm / && s/^rvm ([^ ]+) .*/$1/ && print'" do |channel, stream, data|
22
+ install_rvm = false if data.strip == RVM_VERSION
23
+ end
24
+ if install_rvm
25
+ run "mkdir -p ~/.rvm/src/"
26
+ run "cd ~/.rvm/src/ && rm -Rf rvm-#{RVM_VERSION} && wget -O /dev/stdout -o /dev/null http://rvm.beginrescueend.com/releases/rvm-#{RVM_VERSION}.tar.gz | tar zxf -"
27
+ run "cd ~/.rvm/src/rvm-#{RVM_VERSION} && ./install"
28
+ run "perl -p -i -e 's/^([^#]+&& return.*)/#$1/' ~/.bashrc"
29
+ sudo <<-END
30
+ sh -c '
31
+ grep -F "[[ -s \\$HOME/.rvm/scripts/rvm ]] && source \\$HOME/.rvm/scripts/rvm" ~/.bashrc > /dev/null 2>&1 ||
32
+ echo "[[ -s \\$HOME/.rvm/scripts/rvm ]] && source \\$HOME/.rvm/scripts/rvm" >> ~/.bashrc
33
+ '
34
+ END
35
+ end
36
+ install_rubies
37
+ end
38
+
39
+ task :install_deps do
40
+ top.deprec.mri.install_deps
41
+ apt_packages = rvm_apt_packages.dup
42
+ apt_packages += %w(build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf patch) if rvm_support_mri || rvm_support_ree
43
+ apt_packages += %w(curl sun-java6-bin sun-java6-jre sun-java6-jdk) if rvm_support_jruby
44
+ apt_packages += %w(curl mono-2.0-devel) if rvm_support_ironruby
45
+ apt_packages.uniq!
46
+ apt.install( {:base => apt_packages}, :stable )
47
+ end
48
+
49
+ desc "Install rubies"
50
+ task :install_rubies do
51
+ rubies = rvm_rubies.dup
52
+ rubies ||= []
53
+ rubies.unshift('ruby-1.8.7-p160') if rubies.empty? || rvm_support_rbx
54
+ rubies.uniq!
55
+ rubies.each_with_index do |ruby_def, i|
56
+ ruby = ruby_def.is_a?(Hash) ? ruby_def.keys.first : ruby_def
57
+ env_opts = ""
58
+ configure_opts = ""
59
+ ruby_arch = ruby_def.is_a?(Hash) ? ruby_def.values.first : nil
60
+ if ruby_arch == "i386"
61
+ env_opts = "CFLAGS='-m32' CXXFLAGS='-m32' LDFLAGS='-m32' "
62
+ configure_opts = "--configure --host=i686-pc-linux,--target=i686-pc-linux,--build=i686-pc-linux"
63
+ end
64
+ run "#{env_opts}rvm --reconfigure #{configure_opts} --force install #{ruby}"
65
+ run "rvm --default #{ruby} --passenger" if i == 0 && (rvm_default_ruby.nil? || rvm_default_ruby.empty?)
66
+ end
67
+ if !(rvm_default_ruby.nil? || rvm_default_ruby.empty?)
68
+ set_default = rvm_default_ruby == "system" ? rvm_default_ruby : "--default #{rvm_default_ruby}"
69
+ run "rvm #{set_default} --passenger"
70
+ end
71
+ end
72
+
73
+ end
74
+ end
75
+ end
@@ -3,7 +3,7 @@ Capistrano::Configuration.instance(:must_exist).load do
3
3
  namespace :deprec do
4
4
  namespace :thinking_sphinx do
5
5
 
6
- SRC_PACKAGES[:sphinx] = {
6
+ SRC_PACKAGES[:thinking_sphinx] = {
7
7
  :filename => 'sphinx-0.9.9.tar.gz',
8
8
  :dir => 'sphinx-0.9.9',
9
9
  :url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz",
@@ -18,8 +18,8 @@ Capistrano::Configuration.instance(:must_exist).load do
18
18
 
19
19
  desc "install Sphinx Search Engine"
20
20
  task :install, :roles => :sphinx do
21
- deprec2.download_src(SRC_PACKAGES[:sphinx], src_dir)
22
- deprec2.install_from_src(SRC_PACKAGES[:sphinx], src_dir)
21
+ deprec2.download_src(SRC_PACKAGES[:thinking_sphinx], src_dir)
22
+ deprec2.install_from_src(SRC_PACKAGES[:thinking_sphinx], src_dir)
23
23
  end
24
24
 
25
25
  SYSTEM_CONFIG_FILES[:sphinx] = []
@@ -3,7 +3,7 @@ Capistrano::Configuration.instance(:must_exist).load do
3
3
  namespace :deprec do
4
4
  namespace :ultrasphinx do
5
5
 
6
- SRC_PACKAGES[:sphinx] = {
6
+ SRC_PACKAGES[:ultrasphinx] = {
7
7
  :filename => 'sphinx-0.9.8-rc2.tar.gz',
8
8
  :dir => 'sphinx-0.9.8-rc2',
9
9
  :url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.8-rc2.tar.gz",
@@ -18,8 +18,8 @@ Capistrano::Configuration.instance(:must_exist).load do
18
18
 
19
19
  desc "install Sphinx Search Engine"
20
20
  task :install, :roles => :sphinx do
21
- deprec2.download_src(SRC_PACKAGES[:sphinx], src_dir)
22
- deprec2.install_from_src(SRC_PACKAGES[:sphinx], src_dir)
21
+ deprec2.download_src(SRC_PACKAGES[:ultrasphinx], src_dir)
22
+ deprec2.install_from_src(SRC_PACKAGES[:ultrasphinx], src_dir)
23
23
  end
24
24
 
25
25
  # install dependencies for sphinx
@@ -124,12 +124,12 @@ Capistrano::Configuration.instance(:must_exist).load do
124
124
  }
125
125
 
126
126
  desc "Install syslog-ng"
127
- task :install do
127
+ task :install, :roles => :syslog do
128
128
  install_deps
129
129
  end
130
130
 
131
131
  # install dependencies for syslog-ng
132
- task :install_deps do
132
+ task :install_deps, :roles => :syslog do
133
133
  apt.install( {:base => %w(syslog-ng)}, :stable )
134
134
  end
135
135
 
@@ -162,23 +162,23 @@ Capistrano::Configuration.instance(:must_exist).load do
162
162
  end
163
163
 
164
164
  desc "Push Syslog-ng config files to server"
165
- task :config do
165
+ task :config, :roles => :syslog do
166
166
  deprec2.push_configs(:syslog_ng, SYSTEM_CONFIG_FILES[:syslog_ng])
167
167
  deprec2.push_configs(:syslog, SYSTEM_CONFIG_FILES[:syslog])
168
168
  end
169
169
 
170
170
  desc "Start Syslog-ng"
171
- task :start do
171
+ task :start, :roles => :syslog do
172
172
  run "#{sudo} /etc/init.d/syslog-ng start"
173
173
  end
174
174
 
175
175
  desc "Stop Syslog-ng"
176
- task :stop do
176
+ task :stop, :roles => :syslog do
177
177
  run "#{sudo} /etc/init.d/syslog-ng stop"
178
178
  end
179
179
 
180
180
  desc "Restart Syslog-ng"
181
- task :restart do
181
+ task :restart, :roles => :syslog do
182
182
  run "#{sudo} /etc/init.d/syslog-ng restart"
183
183
  end
184
184
 
@@ -5,9 +5,21 @@ Capistrano::Configuration.instance(:must_exist).load do
5
5
 
6
6
  set :ubuntu_default_term, :linux
7
7
  set :ubuntu_packages_to_install, %w(cron nmap nano bind9-host man-db screen dnsutils iptraf apache2-utils makepasswd psmisc)
8
+ set :ubuntu_apt_preferences, nil # set to a string to upload /etc/apt/preferences
9
+ set :ubuntu_users_remove_admin_group, [] # set to one or more users who should be part of sudo group, but not admin group (for /etc/sudoers to work by default)
8
10
 
11
+ SYSTEM_CONFIG_FILES[:ubuntu] = [
12
+
13
+ {:template => "getlibs.erb",
14
+ :path => '/usr/local/bin/getlibs',
15
+ :mode => 0755,
16
+ :owner => 'root:root'}
17
+
18
+ ]
19
+
9
20
  desc "apt-get update. Resynchronize the package index files from their sources."
10
21
  task :update do
22
+ top.deprec.ubuntu.upload_apt_preferences
11
23
  apt.update
12
24
  end
13
25
 
@@ -16,6 +28,15 @@ Capistrano::Configuration.instance(:must_exist).load do
16
28
  apt.install( {:base => ubuntu_packages_to_install}, :stable )
17
29
  end
18
30
 
31
+ desc "Install 32 bit library support"
32
+ task :install_32bit_libs_support do
33
+ # support 32-bit builds on 64-bit
34
+ apt.install( {:base => %w(gcc-multilib libc6-i386 libc6-dev-i386)}, :stable )
35
+ SYSTEM_CONFIG_FILES[:ubuntu].each do |file|
36
+ deprec2.render_template(:ubuntu, file.merge(:remote => true))
37
+ end
38
+ end
39
+
19
40
  desc "apt-get upgrade. Install the newest versions of all packages currently
20
41
  installed on the system from the sources enumerated in /etc/apt/sources.list.."
21
42
  task :upgrade do
@@ -38,6 +59,20 @@ Capistrano::Configuration.instance(:must_exist).load do
38
59
  # XXX There's one more - add it!
39
60
  end
40
61
 
62
+ task :remove_admin_group_from_users do
63
+ ([ubuntu_users_remove_admin_group] || []).flatten.each do |user|
64
+ sudo "perl -p -i -e 's/^(admin:x:[0-9]+:)([^,]+,)*#{user}(,[^,]+)*/$1/' /etc/group"
65
+ end
66
+ end
67
+
68
+ task :upload_apt_preferences do
69
+ if ubuntu_apt_preferences
70
+ put ubuntu_apt_preferences, "/tmp/preferences", :mode => 0644
71
+ sudo "chown root:root /tmp/preferences"
72
+ sudo "mv /tmp/preferences /etc/apt/"
73
+ end
74
+ end
75
+
41
76
  namespace :utils do
42
77
 
43
78
  namespace :bash do