Wednesday, December 31, 2014

Windows Guest with Vagrant

The Vagrant tool added direct support for Windows guests this year.  Before this release, you could get some limited utility using CygWin and SSH, but now there's support for WinRM.  Hopefully, this will make using provisioning tools like "Puppet" easier.  To enable this feature, have these lines in addition to other configurations in your Vagrantfile:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.communicator = "winrm"
  config.vm.network "forwarded_port", guest: 3389, host: 3389
  config.vm.guest = :windows

  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--memory", "2048"]
    vb.customize ["modifyvm", :id, "--cpus", "2"]
  end
end

One this is setup, if you use Puppet for provisioning, it will use WinRM instead of SSH.  You can also do vagrant rdp, to go directly into a RDP session.

Future versions could add the ability to have a command line session using vagrant ps

Until this feature is merged, you'll have to install an SSH server, such as Bitvise SSH Server, FreeSSHd, or CygWin, in order to get command line console support.

Here's some links regarding this:

No comments:

Post a Comment