rs_vagrant_shim 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rs_vagrant_shim/cli.rb +67 -26
- metadata +4 -4
data/lib/rs_vagrant_shim/cli.rb
CHANGED
@@ -42,35 +42,32 @@ require 'berkshelf/vagrant'
|
|
42
42
|
require 'rs_vagrant_shim'
|
43
43
|
|
44
44
|
Vagrant::Config.run do |config|
|
45
|
-
<% idx = 0 %>
|
46
|
-
|
47
|
-
config.vm.define :<%= vmname %> do |<%= vmname %>_config|
|
48
|
-
<%= vmname %>_config.berkshelf.berksfile_path = "Berksfile"
|
45
|
+
<% idx = 0 %><% boxes.each do |vmname| %>config.vm.define :<%= vmname %>_centos do |<%= vmname %>_centos_config|
|
46
|
+
<%= vmname %>_centos_config.berkshelf.berksfile_path = "Berksfile"
|
49
47
|
|
50
|
-
<%= vmname %>
|
48
|
+
<%= vmname %>_centos_config.vm.host_name = "<%= vmname %>_centos"
|
51
49
|
|
52
|
-
<%= vmname %>
|
53
|
-
<%= vmname %>
|
50
|
+
<%= vmname %>_centos_config.vm.box = "ri_centos6.3_v5.8.8"
|
51
|
+
<%= vmname %>_centos_config.vm.box_url = "https://s3.amazonaws.com/rgeyer/pub/ri_centos6.3_v5.8.8_vagrant.box"
|
54
52
|
|
55
|
-
<%= vmname %>
|
53
|
+
<%= vmname %>_centos_config.vm.network :hostonly, "33.33.33.<%= 10 + idx %>"
|
56
54
|
|
57
|
-
<%= vmname %>
|
58
|
-
<%= vmname %>
|
55
|
+
<%= vmname %>_centos_config.ssh.max_tries = 40
|
56
|
+
<%= vmname %>_centos_config.ssh.timeout = 120
|
59
57
|
|
60
|
-
<%= vmname %>
|
61
|
-
chef.run_list_dir = "runlists/<%= vmname %>"
|
62
|
-
chef.shim_dir = "rs_vagrant_shim/<%= vmname %>"
|
58
|
+
<%= vmname %>_centos_config.vm.provision Vagrant::RsVagrantShim::Provisioners::RsVagrantShim do |chef|
|
59
|
+
chef.run_list_dir = "runlists/<%= vmname %>_centos"
|
60
|
+
chef.shim_dir = "rs_vagrant_shim/<%= vmname %>_centos"
|
63
61
|
end
|
64
62
|
|
65
|
-
<% if options[:storage] %>
|
66
|
-
hdd_file = "rs_vagrant_shim/<%= vmname %>/storage.vdi"
|
63
|
+
<% if options[:storage] %>hdd_file = "<%= vmname %>_centos_storage.vdi"
|
67
64
|
unless File.exists?(hdd_file)
|
68
|
-
<%= vmname %>
|
65
|
+
<%= vmname %>_centos_config.vm.customize [
|
69
66
|
"createhd",
|
70
67
|
"--filename", hdd_file,
|
71
68
|
"--size", 10240
|
72
69
|
]
|
73
|
-
<%= vmname %>
|
70
|
+
<%= vmname %>_centos_config.vm.customize [
|
74
71
|
"storageattach",
|
75
72
|
:id,
|
76
73
|
"--storagectl", "SATA Controller",
|
@@ -78,12 +75,44 @@ Vagrant::Config.run do |config|
|
|
78
75
|
"--type", "hdd",
|
79
76
|
"--medium", hdd_file
|
80
77
|
]
|
78
|
+
end<% end %><% idx += 1 %>
|
79
|
+
end
|
80
|
+
|
81
|
+
config.vm.define :<%= vmname %>_ubuntu do |<%= vmname %>_ubuntu_config|
|
82
|
+
<%= vmname %>_ubuntu_config.berkshelf.berksfile_path = "Berksfile"
|
83
|
+
|
84
|
+
<%= vmname %>_ubuntu_config.vm.host_name = "<%= vmname %>_ubuntu"
|
85
|
+
|
86
|
+
<%= vmname %>_ubuntu_config.vm.box = "ri_ubuntu12.04_v5.8.8"
|
87
|
+
<%= vmname %>_ubuntu_config.vm.box_url = "https://s3.amazonaws.com/rgeyer/pub/ri_ubuntu12.04_v5.8.8_vagrant.box"
|
88
|
+
|
89
|
+
<%= vmname %>_ubuntu_config.vm.network :hostonly, "33.33.33.<%= 10 + idx %>"
|
90
|
+
|
91
|
+
<%= vmname %>_ubuntu_config.ssh.max_tries = 40
|
92
|
+
<%= vmname %>_ubuntu_config.ssh.timeout = 120
|
93
|
+
|
94
|
+
<%= vmname %>_ubuntu_config.vm.provision Vagrant::RsVagrantShim::Provisioners::RsVagrantShim do |chef|
|
95
|
+
chef.run_list_dir = "runlists/<%= vmname %>_ubuntu"
|
96
|
+
chef.shim_dir = "rs_vagrant_shim/<%= vmname %>_ubuntu"
|
81
97
|
end
|
82
|
-
<% end %>
|
83
98
|
|
84
|
-
<%
|
85
|
-
|
86
|
-
|
99
|
+
<% if options[:storage] %>hdd_file = "<%= vmname %>_ubuntu_storage.vdi"
|
100
|
+
unless File.exists?(hdd_file)
|
101
|
+
<%= vmname %>_ubuntu_config.vm.customize [
|
102
|
+
"createhd",
|
103
|
+
"--filename", hdd_file,
|
104
|
+
"--size", 10240
|
105
|
+
]
|
106
|
+
<%= vmname %>_ubuntu_config.vm.customize [
|
107
|
+
"storageattach",
|
108
|
+
:id,
|
109
|
+
"--storagectl", "SATA Controller",
|
110
|
+
"--port", 1,
|
111
|
+
"--type", "hdd",
|
112
|
+
"--medium", hdd_file
|
113
|
+
]
|
114
|
+
end<% end %><% idx += 1 %>
|
115
|
+
end<% end %>
|
87
116
|
end
|
88
117
|
EOF
|
89
118
|
|
@@ -105,8 +134,20 @@ end
|
|
105
134
|
end
|
106
135
|
|
107
136
|
boxes.each do |box|
|
108
|
-
runlist_dir = File.join(projectname, "runlists", box)
|
109
|
-
shim_dir = File.join(projectname, "rs_vagrant_shim", box)
|
137
|
+
runlist_dir = File.join(projectname, "runlists", "#{box}_centos")
|
138
|
+
shim_dir = File.join(projectname, "rs_vagrant_shim", "#{box}_centos")
|
139
|
+
FileUtils.mkdir_p runlist_dir unless File.directory? runlist_dir
|
140
|
+
FileUtils.mkdir_p shim_dir unless File.directory? shim_dir
|
141
|
+
default_runlist_file = File.join(runlist_dir, "default.json")
|
142
|
+
default_runlist_erb = ERB.new(default_runlist_template)
|
143
|
+
File.open(File.join(default_runlist_file), "w") do |file|
|
144
|
+
file.write(default_runlist_erb.result(binding))
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
boxes.each do |box|
|
149
|
+
runlist_dir = File.join(projectname, "runlists", "#{box}_ubuntu")
|
150
|
+
shim_dir = File.join(projectname, "rs_vagrant_shim", "#{box}_ubuntu")
|
110
151
|
FileUtils.mkdir_p runlist_dir unless File.directory? runlist_dir
|
111
152
|
FileUtils.mkdir_p shim_dir unless File.directory? shim_dir
|
112
153
|
default_runlist_file = File.join(runlist_dir, "default.json")
|
@@ -122,9 +163,9 @@ end
|
|
122
163
|
file.write <<-EOF
|
123
164
|
source :rubygems
|
124
165
|
|
125
|
-
# This is probably a bad idea
|
126
|
-
# a specific rs_vagrant_shim
|
127
|
-
gem "rs_vagrant_shim", "~> 0.
|
166
|
+
# This is probably a bad idea while rs_vagrant_shim is evolving, you might wanna consider specifying
|
167
|
+
# a specific rs_vagrant_shim version
|
168
|
+
gem "rs_vagrant_shim", "~> 0.2.0"
|
128
169
|
|
129
170
|
gem "berkshelf", "~> 1.1"
|
130
171
|
gem "vagrant", "~> 1.0.5"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rs_vagrant_shim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: berkshelf
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash: -
|
93
|
+
hash: -1834254762468445183
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash: -
|
102
|
+
hash: -1834254762468445183
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
105
|
rubygems_version: 1.8.24
|