This repository has been archived by the owner on Jan 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
159 lines (142 loc) · 3.75 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# -*- mode: ruby -*-
# vi: set ft=ruby :
boot_timeout = 1200
if ENV["X_VAGRANT_BOOT_TIMEOUT"] != nil
boot_timeout = ENV["X_VAGRANT_BOOT_TIMEOUT"].strip.to_i
end
take_pre_boot_snapshot = false
if ENV["X_VAGRANT_TAKE_PRE_BOOT_SNAPSHOT"] != nil
take_pre_boot_snapshot = ENV["X_VAGRANT_TAKE_PRE_BOOT_SNAPSHOT"] == "true"
end
recording_suffix = Time.now.utc.strftime("%Y%m%dT%H%M%S")
Vagrant.configure(2) do |config|
config.vm.boot_timeout = boot_timeout
config.vm.guest = :windows
config.vm.communicator = "winrm"
config.winrm.username = "IEUser"
config.winrm.password = "Passw0rd!"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.customize [
"modifyvm", :id,
"--cpus", "2",
"--memory", "4096",
"--vram", "128",
"--graphicscontroller", "vboxsvga",
"--paravirtprovider", "default",
"--vrde", "off",
"--usb", "off",
"--clipboard-mode", "disabled",
"--recording", "on",
"--boot1", "disk",
"--boot2", "none",
"--boot3", "none",
"--boot4", "none"
]
end
{
"win7-ie8" => {
"port" => 60600,
"ostype" => "Windows7"
},
"win7-ie9" => {
"port" => 60700,
"ostype" => "Windows7"
},
"win7-ie10" => {
"port" => 60800,
"ostype" => "Windows7"
},
"win7-ie11" => {
"port" => 60900,
"ostype" => "Windows7"
},
"win81-ie11" => {
"port" => 61000,
"ostype" => "Windows8_64"
},
"win10-edge" => {
"port" => 61100,
"ostype" => "Windows10_64"
}
}.each do |name, attr|
config.vm.define "#{name}" do |node|
node.vm.box = "modern.ie/#{name}"
node.vm.provider "virtualbox" do |vb|
vb.customize [
"modifyvm", :id,
"--ostype", attr['ostype'],
"--recordingfile", "recordings/#{name}-#{recording_suffix}.webm"
]
if take_pre_boot_snapshot
vb.customize [
"snapshot", :id,
"take",
"Pre-Boot"
]
end
end
node.vm.network "forwarded_port",
id: "ssh",
guest: 22,
host: attr['port'],
host_ip: "127.0.0.1",
auto_correct: true
node.vm.network "forwarded_port",
id: "winrm",
guest: 5985,
host: attr['port'] + 1,
host_ip: "127.0.0.1",
auto_correct: true
node.vm.network "forwarded_port",
id: "winrm-ssl",
guest: 5986,
host: attr['port'] + 2,
host_ip: "127.0.0.1",
auto_correct: true
node.vm.network "forwarded_port",
id: "rdp",
guest: 3389,
host: attr['port'] + 3,
host_ip: "127.0.0.1",
auto_correct: true
node.vm.usable_port_range = attr['port'] + 10..attr['port'] + 100
node.vm.provision "default", type: "shell" do |s|
s.powershell_elevated_interactive = true
s.inline = %{
$ErrorActionPreference = "Stop"
if ($PSVersionTable.PSVersion.Major -lt 3) {
throw "Wrong PowerShell version"
}
}
end
node.vm.provision "chocolatey", type: "shell", run: "never" do |s|
s.powershell_elevated_interactive = true
s.inline = %{
$ErrorActionPreference = "Stop"
cd C:\\vagrant\\in-action
.\\provision-check.ps1
.\\provision-profile.ps1
.\\provision-performance.ps1
.\\provision-timezone.ps1
.\\provision-powersettings.ps1
.\\provision-chocolatey.ps1
.\\provision-chocolatey-packages.ps1
shutdown /s /t 30 /f
}
end
node.vm.provision "updates", type: "shell", run: "never" do |s|
s.powershell_elevated_interactive = true
s.env = {
"BOX_NAME" => name
}
s.inline = %{
$ErrorActionPreference = "Stop"
cd C:\\vagrant\\in-action
.\\provision-PSWindowsUpdate.ps1
shutdown /s /t 30 /f
}
end
end
end
end