๐ Building a Real-World CI/CD Pipeline with Azure DevOps, Terraform & Ansible (EpicBook Project)
Modern software development is no longer just about writing code โ itโs about automating deployment, infrastructure, and delivery pipelinesโฆ
๐ Building a Real-World CI/CD Pipeline with Azure DevOps, Terraform & Ansible (EpicBook Project)
Modern software development is no longer just about writing code โ itโs about automating deployment, infrastructure, and delivery pipelines so applications can be shipped faster and more reliably.
In this blog, Iโll walk through how I built a complete CI/CD pipeline using Azure DevOps, Terraform, and Ansible to deploy a full-stack application called EpicBook using a real-world DevOps architecture.
๐งฉ Project Overview
This project follows an enterprise-style two-repository model:

๐น 1. Infra Repository (Terraform)
Responsible for provisioning infrastructure:
- Resource Group
- Virtual Network & Subnets
- Virtual Machines (Frontend & Backend)
- MySQL Database
- Outputs (VM IP, DB host)
๐น 2. App Repository (Ansible + Application)
Responsible for application deployment:
- Configuring VMs
- Installing Nginx
- Deploying EpicBook application
- Connecting backend with MySQL

โ๏ธ CI/CD Architecture
The project uses two Azure DevOps pipelines:
๐น Infra Pipeline
Automates infrastructure provisioning using Terraform:
- Install Terraform
- Authenticate using Azure Service Connection (SPN)
- Run:
terraform initterraform planterraform apply- Generate outputs (VM IP, DB host)
- Publish outputs as artifacts

๐น App Pipeline
Automates application deployment using Ansible:
- Install Ansible
- Fetch SSH keys from Secure Files
- Update inventory dynamically using Terraform outputs
- Deploy application on VMs
- Configure Nginx and backend connection

โ๏ธ Azure DevOps Setup
To enable automation, I configured:
๐ Service Principal (SPN)
Used for secure authentication between Azure DevOps and Azure.
๐ Service Connection
Created in Azure DevOps to allow Terraform to provision resources securely.
๐ Secure Files
SSH keys were stored securely in Azure DevOps:
- Used for VM login
- Avoided hardcoding credentials
๐ฆ Variable Groups
Created epicbook-secrets to store sensitive data like:
- Database password (
db_password)
๐๏ธ Infrastructure as Code (Terraform)
Terraform was used to automate infrastructure creation.

Key Features:
- Declarative infrastructure definition
- Azure VM provisioning
- Networking setup (VNet, Subnet)
- MySQL database setup
- Output variables for pipeline integration
Output Example:
- VM Public IP
- Database Host
These outputs were passed to the next pipeline stage for application deployment.
๐ค Configuration Management (Ansible)
Ansible handled configuration and deployment:

Tasks:
- Install Nginx on VMs
- Deploy EpicBook application files
- Configure backend database connection
- Ensure application is accessible via browser

๐ End-to-End CI/CD Workflow
- Code pushed to repository (GitHub/Azure Repo)
- Infra pipeline triggers automatically
- Terraform provisions Azure infrastructure
- Outputs (IP, DB host) are generated
- App pipeline consumes outputs
- Ansible configures servers
- Application is deployed successfully
- EpicBook is accessible via public IP



โ ๏ธ Challenges Faced & Fixes
During implementation, I faced several real-world DevOps issues:
โ Agent Connectivity Issues
- Agent went offline or timed out
- Fixed by restarting self-hosted agent and ensuring stable WSL connection
โ Service Connection Errors
- Fixed incorrect or mismatched service connection names
โ Terraform Backend Issues
- Resolved storage account mismatch and invalid backend configuration
โ Pipeline Blocking on sudo
- Removed sudo usage to avoid password prompts in automation
โ SSH Key Configuration
- Corrected secure file setup in Azure DevOps
๐ Key Learnings
This project helped me understand real-world DevOps practices:
๐น CI/CD Pipelines
- Automated infrastructure + application deployment
- Separation of concerns using multiple pipelines
๐น Terraform (IaC)
- Infrastructure provisioning as code
- State management using Azure Storage backend
๐น Ansible
- Configuration management and automation
- Remote server setup and deployment
๐น Azure DevOps
- Pipeline creation and management
- Service connections & secure authentication
- Secure file and variable group usage
๐น Troubleshooting Skills
- Debugging pipeline failures
- Fixing authentication and backend issues
- Handling real-time agent failures
๐ฏ Final Outcome
At the end of this project:
โ Azure infrastructure was fully automated โ Application was deployed successfully โ CI/CD pipeline worked end-to-end โ No manual intervention required
This project helped me experience how real DevOps pipelines work in production environments.
๐ Conclusion
Building this CI/CD pipeline gave me hands-on experience with:
- Cloud infrastructure automation
- Secure DevOps practices
- Real-world deployment workflows
It strengthened my understanding of how modern applications are built, deployed, and managed in scalable cloud environments.
๋ฉํ๋ฐ์ดํฐ
- post_id
- a4fef122024c
- slug
- building-a-real-world-ci-cd-pipeline-with-azure-devops-terraform-ansible-epicbook-project-a4fef122024c
- url
- https://medium.com/@jadhavaarti056/building-a-real-world-ci-cd-pipeline-with-azure-devops-terraform-ansible-epicbook-project-a4fef122024c
- canonical_url
- https://medium.com/@jadhavaarti056/building-a-real-world-ci-cd-pipeline-with-azure-devops-terraform-ansible-epicbook-project-a4fef122024c
- author_url
- https://medium.com/@jadhavaarti056
- status
- ok
- fetched_at
- 2026-06-17 08:20:12