Cloud / IaC · Freelance
Per-Client WordPress Hosting with Packer, Terraform and Ansible
A Makefile toolchain bakes an AMI with Packer, builds shared infrastructure with Terraform, and onboards or removes clients through Ansible-generated Terraform.
// Overview
Packer with an Ansible provisioner bakes a custom image. A base stack creates the shared ALB, listeners, log bucket and IAM. A client module adds, per tenant, a host-header rule, auto-scaling attachment, shared file system, MariaDB instance and DNS record. An Ansible role templates a per-client Terraform directory from a subdomain argument; delete reverses it.
// The problem
Fast, repeatable onboarding and offboarding of isolated WordPress sites on elastic infrastructure.
// Flow
- Bake imagePacker and Ansible build the AMI
- Base stackshared ALB, listeners, logging bucket, IAM
- Onboard clientone make command with a subdomain
- TemplateAnsible role copies the client Terraform into its own directory
- Client infra gatetarget group, host rule, ASG attachment, file system, database, DNS
- Runtime configuser data injects the database endpoint
- Scalenodes share content on the file system
- Offboarddestroy and remove the directory
// Design decisions & guardrails
- Fixed and repeating infrastructure are split.
- Separate Terraform state per client limits blast radius.
- A shared ALB with host-based routing reduces cost.
// Outcome
Client onboarding reduced to a single command.