solid 0.0.6 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/solid/chef.rb +60 -7
- data/solid.gemspec +2 -2
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.2
|
data/lib/solid/chef.rb
CHANGED
@@ -1,6 +1,30 @@
|
|
1
1
|
module Solid
|
2
2
|
|
3
3
|
class Chef
|
4
|
+
APT_GET = %w{ ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential git-core xfsprogs }
|
5
|
+
RUBYGEMS_DIR = 'rubygems-1.3.7'
|
6
|
+
RUBYGEMS_FILE = "#{RUBYGEMS_DIR}.tgz"
|
7
|
+
RUBYGEMS_URL = "http://rubyforge.org/frs/download.php/70696/#{RUBYGEMS_FILE}"
|
8
|
+
|
9
|
+
CHEF_GEMS = [
|
10
|
+
{:name => 'uuidtools', :version => '2.1.1'},
|
11
|
+
{:name => 'highline', :version => '1.6.1'},
|
12
|
+
{:name => 'moneta', :version => '0.6.0'},
|
13
|
+
{:name => 'extlib', :version => '0.9.15'},
|
14
|
+
{:name => 'abstract', :version => '1.0.0'},
|
15
|
+
{:name => 'erubis', :version => '2.6.6'},
|
16
|
+
{:name => 'json', :version => '1.4.2'},
|
17
|
+
{:name => 'bunny', :version => '0.6.0'},
|
18
|
+
{:name => 'mime-types', :version => '1.16'},
|
19
|
+
{:name => 'rest-client', :version => '1.5.1'},
|
20
|
+
{:name => 'systemu', :version => '1.2.0'},
|
21
|
+
{:name => 'mixlib-log', :version => '1.1.0'},
|
22
|
+
{:name => 'mixlib-authentication', :version => '1.1.4'},
|
23
|
+
{:name => 'mixlib-cli', :version => '1.2.0'},
|
24
|
+
{:name => 'mixlib-config', :version => '1.1.2'},
|
25
|
+
{:name => 'ohai', :version => '0.5.6'},
|
26
|
+
{:name => 'chef', :version => '0.9.8'}
|
27
|
+
]
|
4
28
|
|
5
29
|
def initialize(server, user, options = {})
|
6
30
|
@server = server
|
@@ -12,11 +36,9 @@ module Solid
|
|
12
36
|
unless installed?
|
13
37
|
Net::SSH.start(@server, @user, @options) do |ssh|
|
14
38
|
puts "installing..."
|
15
|
-
|
16
|
-
ssh
|
17
|
-
ssh
|
18
|
-
ssh.exec! "sudo gem update --system"
|
19
|
-
puts ssh.exec! "sudo gem install chef -v 0.9.6 --no-ri --no-rdoc"
|
39
|
+
install_chef_prereqs ssh
|
40
|
+
install_chef_gems ssh
|
41
|
+
build_solo_rb ssh
|
20
42
|
end
|
21
43
|
end
|
22
44
|
end
|
@@ -34,8 +56,8 @@ module Solid
|
|
34
56
|
puts @options.inspect
|
35
57
|
Net::SSH.start(@server, @user, @options) do |ssh|
|
36
58
|
puts "deploying..."
|
37
|
-
|
38
|
-
|
59
|
+
build_json dna, ssh
|
60
|
+
run_solo cookbooks, ssh
|
39
61
|
end
|
40
62
|
end
|
41
63
|
|
@@ -44,5 +66,36 @@ module Solid
|
|
44
66
|
def sudo_cmd
|
45
67
|
'sudo '
|
46
68
|
end
|
69
|
+
|
70
|
+
def install_chef_prereqs ssh
|
71
|
+
[ sudo_cmd + "apt-get update -y",
|
72
|
+
sudo_cmd + "apt-get install #{APT_GET.join(' ')} -y",
|
73
|
+
"wget #{RUBYGEMS_URL} && tar zxf #{RUBYGEMS_FILE} && cd #{RUBYGEMS_DIR} && sudo ruby setup.rb && sudo ln -sfv /usr/bin/gem1.8 /usr/bin/gem",
|
74
|
+
sudo_cmd + "gem update --system"].each do |line|
|
75
|
+
ssh.exec! line
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def install_chef_gems ssh
|
80
|
+
CHEF_GEMS.each do |gem|
|
81
|
+
puts ssh.exec! sudo_cmd + %Q{ gem install #{gem[:name]} -v #{gem[:version]} --no-ri --no-rdoc }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def build_solo_rb ssh
|
86
|
+
['file_cache_path "/tmp/chef-solo"',
|
87
|
+
'cookbook_path ["/tmp/chef-solo/cookbooks", "/tmp/chef-solo/site-cookbooks"]'].each do |line|
|
88
|
+
ssh.exec! "echo '#{line}' >> solo.rb"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def build_json dna, ssh
|
93
|
+
ssh.exec!("echo \"#{dna.to_json.gsub('"','\"')}\" > dna.json")
|
94
|
+
end
|
95
|
+
|
96
|
+
def run_solo cookbooks, ssh
|
97
|
+
puts ssh.exec!(sudo_cmd + " chef-solo -c ~/solo.rb -l debug -j dna.json -r #{cookbooks}")
|
98
|
+
end
|
99
|
+
|
47
100
|
end
|
48
101
|
end
|
data/solid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{solid}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Thing-3"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-07}
|
13
13
|
s.default_executable = %q{solid}
|
14
14
|
s.description = %q{ssh deployment application}
|
15
15
|
s.email = %q{thing3@jackhq.com}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thing-3
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-07 00:00:00 -04:00
|
19
19
|
default_executable: solid
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|