forked from asmagin/sitecore-packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
45 lines (37 loc) · 1.25 KB
/
Vagrantfile
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
require "#{File.dirname(__FILE__)}/src/components/core/vagrant/Vagrantfile.core"
Environment.new(name: 'packer.local') do |environment|
create_packer_vms(environment, 'w16s')
create_packer_vms(environment, 'w16s-dotnet')
create_packer_vms(environment, 'w16s-iis')
end
def create_packer_vms(environment, name)
create_local_packer_vm(environment, name, 'core')
create_local_packer_vm(environment, name, 'sysprep')
create_cloud_packer_vm(environment, name)
end
def create_local_packer_vm(environment, name, type)
PackerVM.new(environment, name: "#{name}-#{type}", box: "local/#{name}-#{type}") do |vm|
VirtualBoxProvider.new(vm) do |provider|
provider.override.vm.box_url = "file://#{File.dirname(__FILE__)}/build/#{name}/virtualbox-#{type}/output/vagrant.box"
end
end
end
def create_cloud_packer_vm(environment, name)
PackerVM.new(environment, name: "#{name}-cloud", box: "scp/#{name}") do |vm|
VirtualBoxProvider.new(vm)
end
end
class PackerVM < VM
@@packer = {
autostart: false,
memory: 8192,
cpus: 2,
linked_clone: false,
}
def self.packer(options = {})
@@packer = @@packer.deep_merge(options)
end
def initialize(environment, options = {})
super(environment, @@packer.deep_merge(options))
end
end