End-to-end demo that provisions AWS infra for Jenkins master/agent, builds a Docker image via Ansible from Jenkins, pushes to Docker Hub, and runs a simple web app.

- Terraform (
infra/): VPC, subnet, modular security groups, EC2 master + slave - Jenkins (
jenkins/): Declarative pipeline to checkout and invoke Ansible - Ansible (
ansbile/): Builds, tags, pushes image, and runs container on the agent - Docker (
docker/): Dockerfile + staticindex.html
- Terraform creates infra; user data installs Jenkins (master) and agent deps (slave)
- Jenkins pipeline (on slave) checks out this repo
- Pipeline runs Ansible playbook to build and push image, then start container
- Web app becomes available on the slave’s public IP (port 80)
- AWS account + credentials for Terraform
- Terraform >= 1.5
- A key pair in AWS (used by instances)
- Valid Ubuntu AMIs for master/slave
- Docker Hub account
- Provision AWS:
cd infra
terraform init
terraform apply -auto-approve
- Get public IPs from AWS console or Terraform outputs
- Access Jenkins:
http://<master-public-ip>:8080(admin/admin123 by default; change it) - In Jenkins, create a Pipeline job pointing to this repo (Jenkinsfile in
jenkins/) - Configure job parameters:
- DOCKERHUB_USERNAME (string)
- DOCKERHUB_PASSWORD (password/token)
- Run the pipeline
- Access the app:
http://<slave-public-ip>
infra/: Terraform modules, variables, and scriptsjenkins/: Jenkins pipeline definitionansbile/: Playbook and docs for build/push/rundocker/: Dockerfile and static site content
cd infra
terraform destroy -auto-approve
- Security groups are modular; attach only what’s needed per instance
- The agent must allow inbound HTTP (80) to expose the demo site
- The
jenkinsuser must be in thedockergroup on the agent