Packer & Ansible
Collection of labs using Packer and Ansible to automate VM image creation and management
Introduction
This workshops is a collection of labs using a selection of the tooling that we commonly see to automate processes around virtual machine image creation. Some of the tooling is designed to work across both Windows and Linux servers, but for the sake of these labs we will separate out the two as most admins naturally gravitate to the most common and native tooling for each. (If you disagree, use the comments below!)
Note that there is a host of useful material within Microsoft Learn and the various quickstarts and how to guides within Microsoft Docs, and it is assumed that you are familiar with many of these.
The aim of these labs is to bring together some of these technologies together into a cohesive set of tooling for standing up virtual machine images.
Pre-requisites
Please set up your laptop as per the automation prereqs page. (TO BE ADDED)
Not everything is needed for the Packer and Ansible labs, but chances are that you’ll dig into the other content as well!
Labs
Packer
Work through some basics with Packer to generate a simple Ubuntu image and then deploy VMs from it.
Ansible
Run some ad hoc Ansible commands against static inventories of virtual machines.
Dynamic Inventories
Create dynamic inventories in Azure based on tags, resource groups and more.
Playbooks & Roles
Using declarative playbooks in Ansible, and installing roles from Ansible Galaxy.
Custom Roles
Sometimes you need a specific role, but there isn't one in Ansible Galaxy. No problem - follow our guide to creating your own.
Shared Image Gallery
Combine Packer with Ansible roles to publish custom images to a Shared Image Gallery.