-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Hyper-V support for Server 2008 R2 to 2016 #8
Conversation
in this case, do you need to run packer-windoze (ie. ansible then packer) from a Windows host?
in the same spirit, what about not using ansible at all in packer's provisioning step? I suspect it would make the support of more packer builders (say, vmware or vsphere) transparent: communicating with the temporary instance would be left to packer, packer-windoze wouldn't have anymore to find out how packer communicates with the instance and pass it over to ansible. (sorry for the noob questions!) |
You still need to run
Mostly it's just how I've set things up so far, there's no reason why you can't just run all this in PowerShell but I see the following as benefits for keeping Ansible in this phase;
The fact that we need to connect to the host outside Packer is painful but until it actually works properly over Windows with the Ansible provisioner, there's not much I can do about it. Arguably the biggest part Ansible plays in this process is the
No need to be sorry, asking questions is healthy and helps us learn more about how things work. |
I have done some testing on this. Everything mostly looked good for 2016/2012R2 builds. Haven't tested others yet. I had a couple problems. The
It would be good to have the hyperv switch name be configurable. Perhaps something like this?
|
Thanks for the info @zoredache, I’ll add your changes to the next commit. If you do end up trying 2008 R2, Packer by itself won’t work. You’ll need to use the changes in the PR hashicorp/packer#6219 so Packer can find the actual IP address. Sadly 2008 (non R2) won’t work at all. |
…re IP of Ansible inventory
Hi,
Seems to be related with calling the script through powershell.exe because directly calling the script in a PS session works fine. |
Thanks for the feedback @stefaz, I've just removed the host calls altogether, you will easily see if something goes wrong or what IP was chosen when the Ansible step runs next. I'm also going to see if the IP Address is available as a variable, I keep on seeing references in some provisioners but need to try it out and see what is possible. |
Thanks everyone for testing and feedback, I'm happy so far with the changes and have started creating the Hyper-V boxes for |
Added support for building an image on Hyper-V for all hosts except Server 2008. Server 2008 R2 is pending a merge and release of hashicorp/packer#6219 in Packer.
Total changes in this PR;
opt_packer_setup_builder
with eitherhyperv
orvirtualbox
(default)mkisofs
but I feel this is a simple tradeoffvars/main.yml
Fixes: #7