Update guest tools install for better vmware support

* make guest tools last so pre-reqs are in place

Packer 1.3.x and possibly more does not inject enviornment
variables as expected into `windows-shell` provisioners, moving
script that requires these into a `shell` provisioner.

* do not trust default uploaded windows.iso

Packer in some cases will upload windows.iso from the host
building the VM, since server 2008 needs a specific older
version of tools this can cause problems.

Example issue:
VMware Fusion 11 on macOS Mojave will supply 10.3.x in windows.iso
and will hit https://kb.vmware.com/s/article/55798 due the patch level
expectaions that are intentionally not met for Windows 2008r2.
This commit is contained in:
Jeffrey Martin 2019-01-04 11:31:06 -06:00
parent 1c1f727d92
commit a4ecd265cf
No known key found for this signature in database
GPG Key ID: 0CD9BBC2AF15F171
2 changed files with 9 additions and 6 deletions

View File

@ -157,7 +157,6 @@
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
"scripts": [
"{{user `scripts_dir`}}/configs/update_root_certs.bat",
"{{user `scripts_dir`}}/installs/vm-guest-tools.bat",
"{{user `scripts_dir`}}/configs/vagrant-ssh.bat",
"{{user `scripts_dir`}}/configs/disable-auto-logon.bat",
"{{user `scripts_dir`}}/configs/enable-rdp.bat"
@ -240,7 +239,15 @@
"{{user `scripts_dir`}}/installs/setup_snmp.bat",
"{{user `scripts_dir`}}/configs/configure_firewall.bat",
"{{user `scripts_dir`}}/installs/install_elasticsearch.bat",
"{{user `scripts_dir`}}/installs/install_flags.bat",
"{{user `scripts_dir`}}/installs/install_flags.bat"
]
},
{
"type": "shell",
"remote_path": "/tmp/script.bat",
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
"scripts": [
"{{user `scripts_dir`}}/installs/vm-guest-tools.bat",
"{{user `scripts_dir`}}/configs/packer_cleanup.bat"
]
},

View File

@ -10,10 +10,6 @@ goto :done
:vmware
if exist "C:\Users\vagrant\windows.iso" (
move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp
)
if not exist "C:\Windows\Temp\windows.iso" (
powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.0.0/2985596/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp"