2021-01-23 14:59:06 +00:00
|
|
|
{
|
|
|
|
"builders": [
|
|
|
|
{
|
|
|
|
"type": "vsphere-iso",
|
2021-02-12 15:44:39 +00:00
|
|
|
"name": "srv2019-t",
|
2021-01-23 14:59:06 +00:00
|
|
|
|
|
|
|
"vcenter_server": "{{user `vcenter_server`}}",
|
|
|
|
"username": "{{user `vsphere_username`}}",
|
|
|
|
"password": "{{user `vsphere_password`}}",
|
|
|
|
"insecure_connection": "true",
|
|
|
|
|
2021-02-12 15:44:39 +00:00
|
|
|
"vm_name": "{{user `vm_guestos`}}-{{user `vm_name`}}-t",
|
|
|
|
"datastore": "{{user `vsphere_datastore`}}",
|
|
|
|
"folder": "{{user `vsphere_folder`}}",
|
|
|
|
"datacenter": "{{user `vsphere_datacenter`}}",
|
|
|
|
"host": "{{user `vsphere_host`}}",
|
|
|
|
"boot_order": "disk,cdrom",
|
|
|
|
|
|
|
|
"guest_os_type": "windows9Server64Guest",
|
|
|
|
|
|
|
|
"communicator": "winrm",
|
|
|
|
"winrm_username": "administrator",
|
|
|
|
"winrm_password": "{{user `winrm_password`}}",
|
|
|
|
"winrm_timeout": "10m",
|
|
|
|
|
|
|
|
"cpus": 2,
|
|
|
|
"RAM": 8192,
|
|
|
|
|
|
|
|
"network_adapters": [
|
|
|
|
{
|
|
|
|
"network": "{{user `vsphere_network`}}",
|
|
|
|
"network_card": "vmxnet3"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"storage": [
|
|
|
|
{
|
|
|
|
"disk_size": 20480,
|
|
|
|
"disk_thin_provisioned": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"disk_controller_type": "lsilogic-sas",
|
|
|
|
"usb_controller": "xhci",
|
|
|
|
|
|
|
|
"iso_url": "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/iso/Microsoft/Windows%20Server%202019/LTSC/en_windows_server_2019_x64_dvd_4cb967d8.iso",
|
|
|
|
"iso_checksum": "sha256:4c5dd63efee50117986a2e38d4b3a3fbaf3c1c15e2e7ea1d23ef9d8af148dd2d",
|
|
|
|
"iso_paths": [
|
|
|
|
"ISO-files/VMware-tools-windows-11.2.1-17243207/VMware-tools-windows-11.2.1-17243207.iso"
|
|
|
|
],
|
|
|
|
"remove_cdrom": true,
|
|
|
|
|
|
|
|
"floppy_files": [
|
|
|
|
"packer/preseed/Server2019/Autounattend.xml",
|
|
|
|
"packer/preseed/Server2019/Sysprep_Unattend.xml",
|
|
|
|
"scripts/Set-NetworkProfile.ps1",
|
|
|
|
"scripts/Disable-WinRM.ps1",
|
|
|
|
"scripts/Enable-WinRM.ps1",
|
|
|
|
"scripts/Install-VMwareTools.cmd"
|
|
|
|
],
|
|
|
|
|
|
|
|
"boot_command": "",
|
|
|
|
"boot_wait": "5m",
|
|
|
|
|
|
|
|
"shutdown_command": "C:\\Windows\\System32\\Sysprep\\sysprep.exe /generalize /oobe /unattend:A:\\Sysprep_Unattend.xml",
|
|
|
|
"shutdown_timeout": "1h",
|
|
|
|
|
|
|
|
"export": {
|
2021-02-13 09:46:43 +00:00
|
|
|
"images": false,
|
|
|
|
"output_directory": "/scratch/srv2019-t"
|
2021-02-12 15:44:39 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "vsphere-iso",
|
|
|
|
"name": "srv2019-v",
|
|
|
|
|
|
|
|
"vcenter_server": "{{user `vcenter_server`}}",
|
|
|
|
"username": "{{user `vsphere_username`}}",
|
|
|
|
"password": "{{user `vsphere_password`}}",
|
|
|
|
"insecure_connection": "true",
|
|
|
|
|
|
|
|
"vm_name": "{{user `vm_guestos`}}-{{user `vm_name`}}-v",
|
2021-01-23 14:59:06 +00:00
|
|
|
"datastore": "{{user `vsphere_datastore`}}",
|
|
|
|
"folder": "{{user `vsphere_folder`}}",
|
|
|
|
"datacenter": "{{user `vsphere_datacenter`}}",
|
|
|
|
"host": "{{user `vsphere_host`}}",
|
|
|
|
"boot_order": "disk,cdrom",
|
|
|
|
|
|
|
|
"guest_os_type": "windows9Server64Guest",
|
|
|
|
|
|
|
|
"communicator": "winrm",
|
|
|
|
"winrm_username": "administrator",
|
|
|
|
"winrm_password": "{{user `winrm_password`}}",
|
|
|
|
"winrm_timeout": "10m",
|
|
|
|
|
|
|
|
"cpus": 2,
|
|
|
|
"RAM": 8192,
|
|
|
|
|
|
|
|
"network_adapters": [
|
|
|
|
{
|
|
|
|
"network": "{{user `vsphere_network`}}",
|
|
|
|
"network_card": "vmxnet3"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"storage": [
|
|
|
|
{
|
|
|
|
"disk_size": 20480,
|
|
|
|
"disk_thin_provisioned": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"disk_controller_type": "lsilogic-sas",
|
|
|
|
"usb_controller": "xhci",
|
|
|
|
|
|
|
|
"iso_url": "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/iso/Microsoft/Windows%20Server%202019/LTSC/en_windows_server_2019_x64_dvd_4cb967d8.iso",
|
|
|
|
"iso_checksum": "sha256:4c5dd63efee50117986a2e38d4b3a3fbaf3c1c15e2e7ea1d23ef9d8af148dd2d",
|
|
|
|
"iso_paths": [
|
|
|
|
"ISO-files/VMware-tools-windows-11.2.1-17243207/VMware-tools-windows-11.2.1-17243207.iso"
|
|
|
|
],
|
|
|
|
"remove_cdrom": true,
|
|
|
|
|
|
|
|
"floppy_files": [
|
|
|
|
"packer/preseed/Server2019/Autounattend.xml",
|
|
|
|
"packer/preseed/Server2019/Sysprep_Unattend.xml",
|
|
|
|
"scripts/Set-NetworkProfile.ps1",
|
|
|
|
"scripts/Disable-WinRM.ps1",
|
|
|
|
"scripts/Enable-WinRM.ps1",
|
|
|
|
"scripts/Install-VMwareTools.cmd"
|
|
|
|
],
|
|
|
|
|
|
|
|
"boot_command": "",
|
|
|
|
"boot_wait": "5m",
|
|
|
|
|
|
|
|
"shutdown_command": "C:\\Windows\\System32\\Sysprep\\sysprep.exe /generalize /oobe /unattend:A:\\Sysprep_Unattend.xml",
|
|
|
|
"shutdown_timeout": "1h",
|
|
|
|
|
|
|
|
"export": {
|
2021-02-13 09:46:43 +00:00
|
|
|
"images": false,
|
|
|
|
"output_directory": "/scratch/srv2019-v"
|
2021-01-23 14:59:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"provisioners": [
|
|
|
|
{
|
|
|
|
"type": "windows-update"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "powershell",
|
|
|
|
"inline": [
|
|
|
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12",
|
|
|
|
"Invoke-Expression ((New-Object Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "powershell",
|
|
|
|
"inline": [
|
|
|
|
"choco config set --name=limit-output --value=LimitOutput",
|
2021-02-10 09:04:04 +00:00
|
|
|
"choco install -y dotnetfx",
|
2021-01-23 14:59:06 +00:00
|
|
|
"choco install -y 7zip.install",
|
2021-04-02 08:52:53 +00:00
|
|
|
"choco install -y sysinternals",
|
2021-04-02 13:50:50 +00:00
|
|
|
"choco install -y microsoft-edge --install-arguments=\"ALLOWINSTALL=1\""
|
2021-01-23 14:59:06 +00:00
|
|
|
],
|
|
|
|
"valid_exit_codes": [0, 3010]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "windows-update"
|
2021-02-12 15:44:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"only": ["srv2019-v"],
|
|
|
|
"type": "powershell",
|
|
|
|
"inline": [
|
|
|
|
"New-Item -Path 'C:\\Payload\\Scripts' -ItemType 'Directory' -Force:$True -Confirm:$False"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"only": ["srv2019-v"],
|
|
|
|
"type": "file",
|
|
|
|
"source": "scripts/Server2019/payload/",
|
|
|
|
"destination": "C:\\Payload\\"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"only": ["srv2019-v"],
|
|
|
|
"type": "powershell",
|
|
|
|
"scripts": [
|
2021-02-12 16:02:05 +00:00
|
|
|
"scripts/Server2019/Register-ScheduledTask.ps1"
|
2021-02-12 15:44:39 +00:00
|
|
|
]
|
2021-01-23 14:59:06 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"post-processors": [[
|
|
|
|
{
|
2021-02-12 15:44:39 +00:00
|
|
|
"only": ["srv2019-t"],
|
2021-01-23 14:59:06 +00:00
|
|
|
"type": "vsphere",
|
|
|
|
"host": "{{user `vcenter_server`}}",
|
|
|
|
"username": "{{user `vsphere_username`}}",
|
|
|
|
"password": "{{user `vsphere_password`}}",
|
|
|
|
"insecure": true,
|
|
|
|
"vm_name": "Windows-Server-2019-LTSC",
|
|
|
|
"datacenter": "{{user `vsphere_datacenter`}}",
|
|
|
|
"cluster": "{{user `vsphere_host`}}",
|
|
|
|
"vm_folder": "{{user `vsphere_templatefolder`}}",
|
|
|
|
"datastore": "{{user `vsphere_datastore`}}",
|
|
|
|
"disk_mode": "thin",
|
|
|
|
"vm_network": "{{user `vsphere_network`}}",
|
|
|
|
"overwrite": true,
|
|
|
|
"keep_input_artifact": true
|
|
|
|
},
|
|
|
|
{
|
2021-02-12 15:44:39 +00:00
|
|
|
"only": ["srv2019-t"],
|
2021-01-23 14:59:06 +00:00
|
|
|
"type": "vsphere-template",
|
|
|
|
"host": "{{user `vcenter_server`}}",
|
|
|
|
"username": "{{user `vsphere_username`}}",
|
|
|
|
"password": "{{user `vsphere_password`}}",
|
|
|
|
"insecure": true,
|
|
|
|
"datacenter": "{{user `vsphere_datacenter`}}",
|
|
|
|
"folder": "{{user `vsphere_templatefolder`}}",
|
|
|
|
"reregister_vm": false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[
|
|
|
|
{
|
2021-02-12 15:44:39 +00:00
|
|
|
"only": ["srv2019-v"],
|
2021-01-23 14:59:06 +00:00
|
|
|
"type": "shell-local",
|
|
|
|
"inline": [
|
|
|
|
"pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\",
|
2021-02-13 21:07:01 +00:00
|
|
|
" -OVFFile '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}-v.ovf' \\",
|
2021-01-23 14:59:06 +00:00
|
|
|
" -Parameter @{'appliance.name'='{{user `vm_guestos`}}';'appliance.version'='{{user `vm_name`}}'}\"",
|
|
|
|
"pwsh -file scripts/Update-Manifest.ps1 \\",
|
2021-02-13 21:07:01 +00:00
|
|
|
" -ManifestFileName '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}-v.mf'",
|
2021-01-23 14:59:06 +00:00
|
|
|
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
|
2021-02-13 21:07:01 +00:00
|
|
|
" '/scratch/srv2019-v/{{user `vm_guestos`}}-{{user `vm_name`}}-v.ovf' \\",
|
2021-01-23 14:59:06 +00:00
|
|
|
" /output/Windows-Server-2019-LTSC.ova"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]]
|
|
|
|
}
|