-
Notifications
You must be signed in to change notification settings - Fork 48
/
Vagrantfile.erb
57 lines (49 loc) · 1.51 KB
/
Vagrantfile.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Vagrant.configure("2") do |c|
c.vm.box = "<%= config[:box] %>"
if Vagrant.has_plugin?("vagrant-cachier")
c.cache.auto_detect = true
c.cache.scope = :box
end
if Vagrant.has_plugin?("vagrant-omnibus")
c.omnibus.cache_packages = true
c.omnibus.chef_version = "11.16.4"
end
c.vbguest.auto_update = false
<% if config[:vm_hostname] %>
c.vm.hostname = "<%= config[:vm_hostname] %>"
<% end %>
<% if config[:guest] %>
c.vm.guest = <%= config[:guest] %>
<% end %>
<% if config[:username] %>
c.ssh.username = "<%= config[:username] %>"
<% end %>
<% if config[:ssh_key] %>
c.ssh.private_key_path = "<%= config[:ssh_key] %>"
<% end %>
<% Array(config[:network]).each do |opts| %>
c.vm.network(:<%= opts[0] %>, <%= opts[1..-1].join(", ") %>)
<% end %>
c.vm.synced_folder ".", "/vagrant", disabled: true
<% config[:synced_folders].each do |source, destination, options| %>
c.vm.synced_folder "<%= source %>", "<%= destination %>", <%= options %>
<% end %>
c.vm.provider :<%= config[:provider] %> do |p|
<% config[:customize].each do |key, value| %>
<% case config[:provider]
when "virtualbox" %>
p.customize ["modifyvm", :id, "--<%= key %>", "<%= value %>"]
<% when "rackspace", "softlayer" %>
p.<%= key %> = "<%= value%>"
<% when /^vmware_/ %>
<% if key == :memory %>
<% unless config[:customize].include?(:memsize) %>
p.vmx["memsize"] = "<%= value %>"
<% end %>
<% else %>
p.vmx["<%= key %>"] = "<%= value %>"
<% end %>
<% end %>
<% end %>
end
end