If you are trying to reproduce this exactly, I'm using the following environment:
- VirtualBox 4.3.12
- Bills Kitchen 3.0-rc4 (includes Vagrant, Packer, Chef, etc)
First challenge is to get a windows basebox from somewhere. I couldn't find a good one, so built one myself from the windows/boxcutter packer templates:
git clone https://github.com/boxcutter/windows.git windows-boxes
cd windows-boxes
make virtualbox/eval-win7x86-enterprise
This takes a while (~45 minutes, depending on your internet connection).
Once the basebox is built, you can import it to Vagrant:
vagrant box add boxcutter/eval-win7x86-enterprise box/virtualbox/eval-win7x86-enterprise-nocm-1.0.4.box
Next I was trying to figure out a minimal Vagrantfile example, which works for all the basic Vagrant things, e.g.:
vagrant up
should not work reliably (not hang / run into timeouts)vagrant ssh
should workvagrant ssh -c "echo foo"
should run the commandvagrant provision
should work, with eitherinline:
orpath:
(.bat / .ps) "shell" provisioner- synced folders should work (via vboxsf or smb ideally)
The Vagrantfile that is packaged within the above built basebox already includes some windows specific settings, such as setting config.vm.communicator = "winrm"
and config.vm.guest = :windows
, so we don't need to repeat that in our Vagrantfile.
So this was my first try:
Vagrant.configure(2) do |config|
config.vm.box = "boxcutter/eval-win7x86-enterprise-nocm"
config.vm.provision "shell", inline: "echo hello!"
config.vm.synced_folder ".", "/vagrant", disabled: true
end
No luck though...
vagrant up
works, but hangs and never completes (I can Ctrl+C though and continue working with the VM)vagrant ssh
works, yay! :-)vagrant ssh -c "echo foo"
drops me into the shell instead of executing the commandvagrant provision
hangs and times out- synced folders I explicitly disabled for now to make it even simpler
Hey @chrisbaldauf @sneal @jimklo thanks for your help!
Seems like I didn't get email notified about your comments since gists don't support that yet :-/
Anyways, I got my issue resolved and it was in fact a WinRM configuration issue, that somehow sneaked in when I built the boxcutter/eval-win7x86-enterprise box. I had to manually set the network adapter to private and run the winrm config mentioned here again: https://github.com/WinRb/WinRM#troubleshooting
At some point in time later, I rebuilt the same boxcutter box (nothing changed or updated), and it suddenly worked. I have rebuilt the box several times since then, and it seems to reliably work right now.
=> i.e. the boxcutter boxes are fine and all of the above commands now work as expected out-of-the-box.
Also thanks for the vagrant-winrm plugin mention, this is super helpful too!