We use Hashicorp Packer to create and maintain Windows Server and Linux VM templates. We then use those templates for server provisioning. We also use packer to maintain AWS AMIs. With packer we can ensure we offer the same source OS configurations across AWS and VMware - same OS families and versions and base configurations. For automated server provisioning this is key because it lets your provisioning workflow make assumptions across all provisioning landscapes as to what is the starting point after the template or AMI is launched. We bake into our templates and AMIs a service account that lets our provisioning process get into the new systems and do privileged tasks. Windows and Linux obviously look different, but all Linux families / versions have the same base config, and all Windows versions have the same base config.
Packer has three stages - builder, provisioner, post-processor.
- The builder stage creates the base image from an ISO (for VMware) or from an AMI (for AWS).
- The provisioner stage logs into that base image and gets it up to the expected base configuration using ansible (and some PowerShell for Windows).
- The post-processor takes the "provisioned" (configured) images and converts them to VMware templates or new AWS AMIs.
I highly recommend learning packer and using it. Learning how to do Debian Preseed or Ubuntu Cloud-Init profiles is a real mess but can be done. Red Hat Kickstart profiles are much easier to build. Windows Server requires learning how to do unattended answer files. All of this is required to master the packer build stage.
A great place to see all this as an example is Jeff Geerling's Packer Boxes project on GitHub.
This was the basis for our Image Factory project that maintains our base VMware templates and AWS AMIs.
The vmare_guest module can easily create VMs from templates. Use packer to maintain the templates. Use Ansible to deploy servers sourcing those templates.
---
Walter Rowe, Chief
Infrastructure Services
NIST Office of Information Systems Management
US Department of Commerce