This lab is currently in Beta, content may be updated as we refine the material
LABBEGINNER

Shell, File, and Ansible Provisioners

Provision an Ubuntu 24.04 AMI with file, shell, and ansible-local (nginx), practice continue_on_error, validate Azure and GCP sidecar templates that share the same provisioner blocks, then deregister the AMI and delete its snapshot.

45 minutes
hashicorp/packer
Shell, File, and Ansible Provisioners - Platform Engineering Hands-On Lab Icon
Share this Lab

Lab Overview

This is the hands-on lab for Section 7 of Packer 101. You write an amazon-ebs template that bakes on t3.small, uploads a configure script with the file provisioner, runs it with shell, installs ansible-core 2.21.4 on the guest (PEP 668 pip with --break-system-packages), then uses ansible-local to install nginx. One deliberate optional shell step is marked continue_on_error so the build continues after a non-zero exit. You intentionally break a provisioner path, read the validate error, and fix it. After the bake you prove the AMI with the AWS CLI, then fmt and validate Azure and GCP sidecar templates that reuse the same provisioner chain without building them. Cleanup deregisters the AMI and deletes its EBS snapshot.

You will:

  • Confirm Packer 1.16.0 and AWS credentials on the lab host
  • Author aws-ubuntu.pkr.hcl with amazon ~> 1.8, ansible ~> 1.1, and t3.small
  • Stage scripts/configure-app.sh and playbooks/nginx.yml, then init, fmt, and

validate

  • Recover from a deliberate broken playbook and file path
  • Build the AMI, prove it, and validate Azure/GCP sidecars that share the

provisioner blocks

  • Deregister the AMI and delete its snapshot

What You'll Learn

Confirm Packer 1.16.0 and AWS identity on the packer-host lab VM

Author an amazon-ebs template with file, shell, ansible-local, and continue_on_error

Install ansible-core 2.21.4 on a t3.small guest via pip --break-system-packages

Build an AMI that installs nginx with ansible-local and validate Azure/GCP sidecars

Deregister the AMI and delete its EBS snapshot

Prerequisites

Completion of the Packer 101 Section 7 lessons on shell, file, and ansible provisioners

Completion of the First AWS AMI lab (or equivalent amazon-ebs basics)

Basic Linux command line (bash, reading logs)

Technologies Covered

packeramazon-ebsamiawsansibleansible-localnginxprovisionersubuntugolden-imageshcl2

Part of a Course

This lab is part of the Packer 101 — Golden Images for AWS, Azure, and GCP course

View All Courses

Choose your plan

Simple, Transparent Pricing

Unlock full access to TeKanAid courses, labs, and bootcamps

Buying for a team? Private corporate training is available for up to 15 learners.View team training
MonthlyQuarterly
Try Premium free for 7 days →

Just exploring? Start free below. Want the full experience? Try Premium free for 7 days (card required, $0 today).

Pro

All courses, with lab scripts to run on your own machine

$59/month

Renews automatically. Cancel anytime.

Final price verified at checkout.

  • Full access to all courses
  • Lab scripts to download and run on your own machine (hosted labs not included)
  • Progress tracking
  • Certificate of completion
  • Community access
  • Self-paced bootcamps
  • Premium puzzle library not included (5 free puzzles available)
  • New content access
Recommended

Premium

Full access, including unlimited hosted labs

$99/month

Renews automatically. Cancel anytime.

Final price verified at checkout.

  • Everything in Pro
  • Unlimited hands-on labs, fully hosted on TeKanAid Academy (nothing to set up)
  • Full access to the puzzle library
  • Lab AI Assistant
  • Priority support

Prefer a single course?

Purchase individual courses for a one-time fee of $79. Full access to course content, quizzes, certificates, and community features, lab access is not included.

Browse Courses

Just exploring? Start free, no account needed

Three free ways to start. All bridge into the paid Premium catalog when you're ready.

Not ready to commit? The crash course is email-only. No academy account required.

Ready to Get Started?

Start this hands-on lab and build real-world Platform Engineering skills

Get Access Now