forked from rgl/windows-vagrant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
165 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Download the latest `packer-builder-vsphere-iso.exe` release from [jetbrains-infra/packer-builder-vsphere](https://github.com/jetbrains-infra/packer-builder-vsphere/releases) and place it inside your `%APPDATA%\packer.d\plugins` directory. | ||
|
||
Download the Windows Evaluation iso (you can find the full iso URL in the [windows-2016.json](windows-2016.json) file) and place it inside the datastore as defined by the `vsphere_iso_url` user variable that is inside the [packer template](windows-2016-vsphere.json). | ||
|
||
Download the VMware Tools zip and extract the `windows.iso` file into the datastore defined by the `vsphere_tools_iso_url` user variable that is inside the [packer template](windows-2016-vsphere.json). | ||
|
||
Build the base box with: | ||
|
||
```bash | ||
make build-vsphere | ||
``` | ||
|
||
**NB** the generated template will include a reference to the extra iso images that were used to create the template, which is a bummer. | ||
|
||
**NB** these errors are expected (should be fixed when https://github.com/jetbrains-infra/packer-builder-vsphere/pull/82 is release): | ||
``` | ||
==> windows-2016-amd64-vsphere: error removing floppy: The operation is not supported on the object. | ||
==> windows-2016-amd64-vsphere: error removing cdroms: The operation is not supported on the object. | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Set-StrictMode -Version Latest | ||
$ProgressPreference = 'SilentlyContinue' | ||
$ErrorActionPreference = 'Stop' | ||
trap { | ||
Write-Host | ||
Write-Output "ERROR: $_" | ||
Write-Output (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1') | ||
Write-Host 'Sleeping for 60m to give you time to look around the virtual machine before self-destruction...' | ||
Start-Sleep -Seconds (60*60) | ||
Exit 1 | ||
} | ||
|
||
$systemVendor = (Get-WmiObject Win32_ComputerSystemProduct Vendor).Vendor | ||
if ($systemVendor -eq 'VMware, Inc.') { | ||
Write-Output 'Installing VMware Tools...' | ||
# silent install without rebooting. | ||
E:\setup64.exe /s /v '/qn reboot=r' ` | ||
| Out-String -Stream | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{ | ||
"variables": { | ||
"vsphere_disk_size": "60", | ||
"vsphere_iso_url": "[Datastore] iso/14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO", | ||
"vsphere_tools_iso_url": "[Datastore] iso/vmware-tools-10.2.5/windows.iso", | ||
"vsphere_host": "vcenter.local", | ||
"vsphere_username": "[email protected]", | ||
"vsphere_password": "password", | ||
"vsphere_esxi_host": "esxi.local", | ||
"vsphere_datacenter": "Datacenter", | ||
"vsphere_cluster": "Cluster", | ||
"vsphere_datastore": "Datastore", | ||
"vsphere_folder": "test", | ||
"vsphere_network": "packer" | ||
}, | ||
"builders": [ | ||
{ | ||
"name": "windows-2016-amd64-vsphere", | ||
"vm_name": "windows-2016-amd64-vsphere", | ||
"type": "vsphere-iso", | ||
"guest_os_type": "windows9Server64Guest", | ||
"disk_size": "{{user `vsphere_disk_size`}}", | ||
"disk_thin_provisioned": true, | ||
"disk_controller_type": "pvscsi", | ||
"vcenter_server": "{{user `vsphere_host`}}", | ||
"username": "{{user `vsphere_username`}}", | ||
"password": "{{user `vsphere_password`}}", | ||
"insecure_connection": "true", | ||
"datacenter": "{{user `vsphere_datacenter`}}", | ||
"cluster": "{{user `vsphere_cluster`}}", | ||
"host": "{{user `vsphere_esxi_host`}}", | ||
"folder": "{{user `vsphere_folder`}}", | ||
"datastore": "{{user `vsphere_datastore`}}", | ||
"network_card": "vmxnet3", | ||
"network": "{{user `vsphere_network`}}", | ||
"convert_to_template": true, | ||
"RAM": 2048, | ||
"CPUs": 4, | ||
"iso_paths": [ | ||
"{{user `vsphere_iso_url`}}", | ||
"{{user `vsphere_tools_iso_url`}}" | ||
], | ||
"floppy_files": [ | ||
"autounattend.xml", | ||
"vmtools.ps1", | ||
"winrm.ps1" | ||
], | ||
"boot_order": "disk,cdrom", | ||
"communicator": "winrm", | ||
"winrm_username": "vagrant", | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "4h", | ||
"shutdown_command": "shutdown /s /t 0 /f /d p:4:1 /c \"Packer Shutdown\"" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"type": "powershell", | ||
"script": "disable-windows-updates.ps1" | ||
}, | ||
{ | ||
"type": "powershell", | ||
"inline": "Uninstall-WindowsFeature Windows-Defender-Features" | ||
}, | ||
{ | ||
"type": "powershell", | ||
"inline": "Uninstall-WindowsFeature FS-SMB1" | ||
}, | ||
{ | ||
"type": "powershell", | ||
"script": "virtualbox-prevent-vboxsrv-resolution-delay.ps1" | ||
}, | ||
{ | ||
"type": "windows-restart" | ||
}, | ||
{ | ||
"type": "windows-update", | ||
"filters": [ | ||
"exclude:$_.Title -like '*Preview*'", | ||
"include:$_.Title -like '*Cumulative Update for Windows*'", | ||
"include:$_.AutoSelectOnWebSites" | ||
] | ||
}, | ||
{ | ||
"type": "powershell", | ||
"script": "provision.ps1" | ||
}, | ||
{ | ||
"type": "powershell", | ||
"script": "provision-openssh.ps1" | ||
}, | ||
{ | ||
"type": "windows-restart" | ||
}, | ||
{ | ||
"type": "powershell", | ||
"script": "eject-media.ps1" | ||
}, | ||
{ | ||
"type": "powershell", | ||
"script": "optimize.ps1" | ||
} | ||
] | ||
} |