Packer scripts for Windows VM

71 views
Skip to first unread message

Mohan Radhakrishnan

unread,
May 16, 2020, 8:40:45 AM5/16/20
to Packer
Hi,
         I tried to build a VM with vmware.iso in Ubuntu on VirtualBox. But I think since the environment on which I tried to build is itself
virtualized I faced this issues (https://github.com/hashicorp/packer/issues/9242). But I am not sure if it is possible or not.

Now I am looking for a set of scripts to run on my host Windows OS. I need to start with vmware.iso and provision some Java tools.
Everywhere I search they show examples with vsphere.iso and I don't have a vsphere server on my desktop.


Thanks,
Mohan

TheTube

unread,
May 16, 2020, 2:53:15 PM5/16/20
to Packer
Don't run on windows. there is a bug in doing so. Use Linux. Use a provider where you cn virtualise. Azutere, GPC or use packet.

Op zaterdag 16 mei 2020 14:40:45 UTC+2 schreef Mohan Radhakrishnan:

Megan Marsh

unread,
May 19, 2020, 2:57:18 PM5/19/20
to packe...@googlegroups.com
My windows VM is in vmware also, but I run it directly on my OSX machine so I only have to deal with one layer of virtualization and don't have specific advice for that. That said, I like the https://github.com/StefanScherer/packer-windows packer templates a lot for building windows images and they have vmware-iso builders. 

If you don't need to package the image into a Vagrant box though, you'll want to remove Vagrant the post-processors.

Eric Richardson

unread,
May 19, 2020, 3:31:30 PM5/19/20
to packe...@googlegroups.com
Hi Megan -

Thanks for the response, that's what I was worried about.

Reading the Packer docs, it sounded like the user data provided to the packer "user_data_file" attribute shouldn't persist, but it seems like that goes out the window when Windows and Sysprep are thrown into the mix.

I looked at clearing the user data as part of my provisioning using AWS for Powershell command Edit-EC2InstanceAttribute, but it appears that only works on a stopped instance.

So unfortunately, it sounds like if you use "user_data_file" for initial WinRM configuration in Packer, you're out of luck if you want to use user data for child instances created from the custom AMI.

Don't want to increase the scope of the question too much, but is there a better way to initiate WinRM connection than using "user_data_file"? As I mentioned, that seemed to be the only way I could get WinRM up and running and was recommended in most of the docs I found.

On Tue, May 19, 2020 at 12:57 PM Megan Marsh <megan....@gmail.com> wrote:
My windows VM is in vmware also, but I run it directly on my OSX machine so I only have to deal with one layer of virtualization and don't have specific advice for that. That said, I like the https://github.com/StefanScherer/packer-windows packer templates a lot for building windows images and they have vmware-iso builders. 

If you don't need to package the image into a Vagrant box though, you'll want to remove Vagrant the post-processors.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAGPV1uqjP8ivipcVKaLKz1OWPvBsAfK7MzQZVgL5ptf%2BDgzGow%40mail.gmail.com.


--
++Eric

Megan Marsh

unread,
May 19, 2020, 3:46:13 PM5/19/20
to packe...@googlegroups.com
Unfortunately, user_data_file is basically the only way to get that initial configuration set up. I wonder if before the sysprep you could overwrite that file so the values in it are different.

Eric Richardson

unread,
May 19, 2020, 4:33:41 PM5/19/20
to packe...@googlegroups.com
Thanks again, Megan. I didn't have much success so far trying to clear/update user data as part of provisioning but will keep playing around with it.



--
++Eric

Megan Marsh

unread,
May 19, 2020, 6:26:00 PM5/19/20
to packe...@googlegroups.com
@TheTube Often developers don't have a choice of which technology or virtualization platform they have to use, so "don't use Windows" isn't a very helpful response, no matter how deeply you hold the opinion that Linux is a superior platform.  https://www.hashicorp.com/community-guidelines 

Thanks!

Mohan Radhakrishnan

unread,
May 22, 2020, 9:01:00 AM5/22/20
to Packer
I didn't understand.  I have a Windows host and Virtual Box and Ubuntu on it. Inside Ubuntu I run the packer script which opens VMWare workstation and starts to proviision another Ubuntu VM. I am just trying to build the image so that I can try to provision software using Ansible etc. So the focus is software provisioning but I just decided to use my existing Ubuntu because it was there.

So I assume the error in https://github.com/hashicorp/packer/issues/9242 means there is nested virtualization and it is not supported. Is that what you meant ? 

Thanks,
Mohan
Reply all
Reply to author
Forward
0 new messages