Packer Community Templates for Windows
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
answer_files
scripts
2012r2-parallels.json
2012r2-virtualbox.json
LICENSE
README.md
amazon-sysprep.json
vagrantfile-windows_2012_r2.template

README.md

Packer Community Example Templates

Packer Community Templates for Windows environments to test/showcase many of the Windows-specific Builders and Provisioners.

Running

  • Install Packer and Packer Community

  • Clone this repo:

    git clone git@github.com:mefellows/packer-windows-templates.git && cd packer-community-templates
    
  • Run Packer

    Common practice is to create intermediate boxes in machine image pipelines, such as a 'Base' and 'Application' images. The examples below follow this pattern.

    Vagrant Boxes

    Run the ISO builder to produce a simple Base box with VirtualBox guest additions and optionally Windows updates (Uncomment the relevant lines in the Autounattend.xml files to enable this):

    packer build -only=virtualbox-windows-iso 2012r2-virtualbox.json
    

    Run the OVF builder to produce a simple base box with rsync and Seek DSC resources installed:

    packer build -only=virtualbox-windows-ovf 2012r2-virtualbox.json
    

    AWS Machines

    packer build --var base_ami=ami-ac3a1cc4 --var subnet_id=subnet-1234abcd--var vpc_id=vpc-4567defg ./amazon-sysprep.json
    

Windows Updates

Use the /answer_files/2012_r2/updates/Autounattend.xml file as a replacement in the floppy_files configuration item.

Sysprep

An example unattended sysprep file is automatically uploaded to c:/Windows/Temp/Autounattend_sysprep.xml which can be used in a provisioner to sysprep the machine. For example, you may replace the default shutdown_command in the OVF builder with the following:

"shutdown_command": "c:/windows/system32/sysprep/sysprep.exe /generalize /oobe /quiet /shutdown /unattend:c:/Windows/Temp/Autounattend_sysprep.xml",
"shutdown_timeout": "15m"

NOTE: This currently impacts the rsync (SSH) capability due to SIDs and such.

Credits

Thanks to Joe's joefitzgerald/packer-windows templates for the inspiration and basis for much of this work.