Open JVimes opened 10 years ago
In my fork, you do it the same way as the virtualbox builder.
{
"vm_name": "win2008-standard",
"type": "hyperv-iso",
"guest_os_type": "windows7srv-64",
"iso_url": "{{ user `iso_url` }}",
"iso_checksum": "{{ user `iso_checksum` }}",
"iso_checksum_type": "sha1",
"floppy_files": [
"floppy/win2008-standard/Autounattend.xml",
"floppy/00-run-all-scripts.cmd",
"floppy/install-winrm.cmd",
"floppy/powerconfig.bat",
"floppy/01-install-wget.cmd",
"floppy/_download.cmd",
"floppy/_packer_config.cmd",
"floppy/passwordchange.bat",
"floppy/openssh.bat",
"floppy/zz-start-sshd.cmd"
],
"disk_size_gb": 40,
"wait_time_minutes": 10,
"ram_size_mb": 1024
},
I have added a new step,
&common.StepCreateFloppy{ Files: b.config.FloppyFiles },
and removed the mounting of the embedded floppy image for Server 2012 R2. You can add any file to the floppy as long as it fits in the 1.44MB. I have plans to extend provisioner so that I can install things like windows updates via [Windows Updates Offline(http://download.wsusoffline.net/), Visual Studio, SQL Server, etc.
That's great, thanks! If it's stable, that needs to get pulled in :) About the provisioning, aren't those already handled by the supported Packer provisioners? I guess I haven't done much with them yet (doing that later, in Vagrant), so maybe there's something I don't know.
I am not sure about the provisioners either. It could do what I want already. Basically, I need to be able to specify the iso file to mount and then a command to run to do the silent install.
On my fork, I have created some goals that I want to accomplish by forking. I would be interested in other people's use cases. For example, I am only interested in running stuff against the local Hyper-V instance. Others may want to provision against a remote hyper-v server. I would be interested in anything special you are looking to do.
Easy ISO mounting would be nice. There's a cmdlet in PowerShell 4.0 (some OS's would have update), but it's not mounting it using the VM technology, you'd have to make it visible within the VM using a shared folder, etc.
I tried your fork with configuration like that in your comment, and got "Unknown configuration key" on floppy_files and a few others. Have the latest changes been pushed? Or is the bin directory old, perhaps? The sample json in bin looks stock. I've never built .go files before. Is there a project file to start from?
I'm trying to build a vagrant box to run a build. I'd like to run it locally in Hyper-V while I'm authoring it, and occasionally for special purposes. Later, it'll run on a server although probably not in Hyper-V. At my last job, we had a couple build VMs running on a Hyper-V server, though.
I just updated in plugin in the bin directory and the config file sample. I have been testing against a Windows Server 2008 install. I am also using a fork of box-cutter/windows-vm. To run it, copy the plugin to the packer bin directory. I use a batch file to kick off VM build. There are a number of known issues still:
Here is an example:
E:\work\packer\windows-vm>type pack-it-2008.cmd
SETLOCAL
PATH=C:\tools\packer-0.7.1;%PATH%
SET HYPERV_BUILDER=hyperv-iso
SET PACKER_VARS=
SET ISO_URL=F:\my-msdn\operating-systems\windows-server-2008\en_windows_server_2008_datacenter_enterprise_standard_sp2_x86_dvd_342333.iso
SET ISO_CHECKSUM=
packer build -only=%HYPERV_BUILDER% %PACKER_VARS% -var "iso_url=%ISO_URL%" -var "iso_checksum=%ISO_CHECKSUM%" win2008-standard.json
E:\work\packer\windows-vm>pack-it-2008.cmd
E:\work\packer\windows-vm>packer build -only=hyperv-iso -var "iso_url=F:\my-msdn\operating-systems\windows-server-2008\en_windows_server_2008_datacenter_enterprise_standard_sp2_x86_dvd_342333.iso" -var "iso_checksum=" win2008-standard.json
hyperv-iso output will be in this color.
Warnings for build 'hyperv-iso':
* Hyper-V might fail to create a VM if there is no available memory in the system.
==> hyperv-iso: Creating temporary directory...
==> hyperv-iso: Creating floppy disk...
hyperv-iso: Copying: floppy/win2008-standard/Autounattend.xml
hyperv-iso: Copying: floppy/00-run-all-scripts.cmd
hyperv-iso: Copying: floppy/install-winrm.cmd
hyperv-iso: Copying: floppy/powerconfig.bat
hyperv-iso: Copying: floppy/01-install-wget.cmd
hyperv-iso: Copying: floppy/_download.cmd
hyperv-iso: Copying: floppy/_packer_config.cmd
hyperv-iso: Copying: floppy/passwordchange.bat
hyperv-iso: Copying: floppy/openssh.bat
hyperv-iso: Copying: floppy/zz-start-sshd.cmd
==> hyperv-iso: Creating Internal switch...
==> hyperv-iso: Creating virtual machine...
==> hyperv-iso: Enabling Integration Service...
==> hyperv-iso: Mounting dvd drive...
==> hyperv-iso: Mounting floppy drive...
==> hyperv-iso: Starting vm...
==> hyperv-iso: Installing! Waiting for 10 minutes to let the action to complete...
Good plan. I would, but there's no "Issues" section ;) Not sure where else to post. I'm not seeing the latest commit. Did it get pushed?
Added Issues to my project.
Thanks, pbolduc, really helpful !!
Old issue but did this ever get pulled in?
The correct place to look is https://github.com/mitchellh/packer/pull/2576 there has been extensive work done on the hyper-v builder.
Is there a way to reference an answer file in the json so that it will be mounted/used at install time? If not, that'd be nice.