Interview Prep/Ansible/Project Structure and Design

Golden images (Packer) versus configuring at boot with Ansible: how do you choose?

AdvancedProductionProject Structure and Design
Answer

Bake what is slow, stable and shared (OS hardening, runtimes, agents) into an AMI with Packer and the Ansible provisioner. Configure at boot only what varies per environment or instance (hostnames, endpoints, secrets) via user-data, cloud-init, or ansible-pull.

Baking gives fast, consistent autoscaling and fewer boot-time failures, but needs an image pipeline and rebuilds for every patch. Boot-time Ansible gives flexibility, but slows scale-out and fails when package repos or the network are down at that moment. We bake, and keep Ansible as the single source of truth for both stages, so the same roles produce the image and later correct drift.

All Ansible questions Roadmap: Ansible

More on Project Structure and Design