A simulated multi-tier infrastructure environment built using Docker containers and automated with Ansible. This project demonstrates how configuration management tools can be used to provision and manage infrastructure components such as load balancers, web servers, and databases in a controlled lab environment. The lab replicates a simplified production-style architecture while running entirely on a single machine.
The system simulates a layered infrastructure environment.
+--------------------+
| Ansible Host |
| Control Node |
+----------+---------+
|
SSH / Automation
|
+-----------------+-----------------+
| |
v v
+-------------------+ +-------------------+
| server_2 |-------------->| server_3 |
| Load Balancer(80) | | App Server(8080) |
+---------+---------+ +---------+---------+
| |
| |
+-----------------+-----------------+
|
v
+-------------------+
| server_1 |
| Database (5432) |
+-------------------+
The Ansible control node (host) manages and configures all infrastructure components via SSH.
Distributes incoming requests to backend services (exposes port 80).
Handles application logic and processes client requests (exposes port 8080).
Stores application data and provides backend persistence (exposes port 5432).
ansible-lab
│
├── assets/ # Architecture diagrams and visuals
│
├── keys/ # Generated SSH keys for cluster auth
│
├── host
│ └── Dockerfile
│
├── server_1
│ └── Dockerfile
│
├── server_2
│ └── Dockerfile
│
├── server_3
│ └── Dockerfile
│
├── ansible-lab.sh
├── docker-compose.yml
├── howto.md
├── SECURITY.md
├── ACKNOWLEDGEMENT.md
└── README.mdActs as the Ansible control node responsible for running automation playbooks and managing the environment. Runs with IP 172.20.0.30.
Database service intended for backend persistence, simulating a service like PostgreSQL. Exposes ports 22 and 5432. Runs with IP 172.20.0.10 (Key-based SSH login).
Represents the traffic routing layer responsible for distributing incoming requests. Exposes ports 22 and 80. Runs with IP 172.20.0.20 (Key-based SSH login).
Application server responsible for handling requests and communicating with the database. Exposes ports 22 and 8080. Runs with IP 172.20.0.5 (Key-based SSH login).
Defines and orchestrates the multi-container infrastructure environment with a custom bridge network assigning static IPs to each container.
A unified CLI wrapper script intended to automate the environment. Includes commands to init (install dependencies and generate SSH keys), start, stop, clean, and check status.
| Technology | Purpose |
|---|---|
| Docker | Containerized infrastructure simulation |
| Docker Compose | Multi-container orchestration |
| Ansible | Infrastructure automation and configuration management |
| Linux (Debian) | Base operating system |
| SSH | Remote automation and configuration |
This lab demonstrates several important DevOps and Infrastructure Engineering concepts:
- Infrastructure automation using Ansible
- Multi-tier architecture design
- Containerized infrastructure environments
- Configuration management workflows
- Infrastructure simulation for safe experimentation
Testing automation tools such as Ansible often requires multiple servers. This lab provides a safe and reproducible environment where infrastructure automation can be practiced without needing multiple physical or cloud machines. By simulating infrastructure using Docker containers, the project allows experimentation with:
- Configuration management
- Service orchestration
- Infrastructure provisioning
- Network communication between services
Clone the repository:
git clone https://github.com/anubhavbuildz/ansible-lab.git
cd ansible-labBuild and start the infrastructure:
./ansible-lab.sh init
./ansible-lab.sh startDocker will build all service containers and start the infrastructure environment.
Through this project I practiced:
- Designing multi-tier infrastructure
- Using Ansible for automation
- Simulating infrastructure using containers
- Managing service dependencies
- Understanding infrastructure communication patterns
Potential improvements to extend this lab:
- Add multiple web servers for load balancing
- Implement Nginx reverse proxy configuration
- Integrate monitoring tools (Prometheus, Grafana)
- Add CI/CD automation pipelines
- Deploy the architecture on Kubernetes
Anubhav Sharma
Cloud • DevOps • Systems Engineering

