This repo is meant to be a very simple way to build out windows boxes for the VirtualBox provider with Packer for use with Vagrant.
- Clone this repo locally
- Gather up your windows ISOs ( Windows2012R2 ) and place them in the corresponding ISOs folder. You
can find these in various locations some listed below.
- Microsoft Evaluation Center
- MSDN
- Any local sources
Once you have cleared the above pre-requisites run the following at the root of this repo.
> gem install bundler
> bundle
> Rake build
Once the above has finished you should see two vagrant boxes in the box directory.
- vagrant-windows2012R2.box
- vagrant-windows2012R2Core.box
The boxes in this repo are specifically built to use Chocolatey and winrm with vagrant out of the box without having to install cygwin or similar packages on the guest os.
Each of the boxes have been worked through to bring them down to a more manageable size. Details of
what this entails can be seen in the bootstrap.ps1
script in this repo.
The Vagrantfile packed with each box is shown below.
Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--vram","30"]
v.memory = 2048
v.cpus = 1
end
config.vm.guest = :windows
config.vm.communicator = "winrm"
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true
config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true
end
This will default every box to using the winrm communicator as well as forward the ports for winrm as
well as the vagrant rdp
command.
Each of the boxes are initially built via Packer with the following settings.
v.customize ["modifyvm", :id, "--vram","30"]
v.memory = 4096
v.cpus = 2
As shown in the default Vagrantfile above however these specs are cut back to the following.
v.customize ["modifyvm", :id, "--vram","30"]
v.memory = 2048
v.cpus = 1
Each of the boxes will have the following packages installed. These can be modified in the packer .json files if needed.
- Git - Latest chocolatey version
- Chef - 12.1.0.1
- Puppet - Latest chocolatey version
All of the included Autounattend.xml
files have no Windows activation key set. This can be set
in the following location in each Autounattend.xml
<ProductKey>
<!-- Input Key Here-->
<Key>PLACEKEYHERE</Key>
<WillShowUI>Never</WillShowUI>
</ProductKey>
This repo has been tested using the following setups. But should work with various configurations of the listed software packages.
- Vagrant - 1.7.4
- Packer - 0.8.2
- VirtualBox - 5.0.2 r102096
- Ruby - 1.9.3
- Vagrant - 1.7.4
- Packer - 0.8.2
- VirtualBox - 5.0.6 r103037
- Ruby - 1.9.3
Currently the ServerSpec checks are looking for a few basic items.
- Powershell ExecutionPolicy is set to Bypass.
- Chocolatey has installed correctly.
- Git has installed correctly.
- Puppet has installed correctly.
- Chef has installed correctly.
- VirtualBox Guest Additions have been installed.
The following two links were very helpful resources in building out this repo
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request