This repository contains two sub-projects for automating the provisioning and configuration of a cloud environment | 1. **Terraform Project** | 2. **Ansible Project** |
---|---|---|
Automates the provisioning of cloud infrastructure using CSC's OpenStack `cPouta` service. |
Configures and deploys a load balancer and web servers across the provisioned infrastructure. |
This project demonstrates the complete lifecycle of deploying and configuring a cloud environment:
-
Provision Infrastructure: Use Terraform to create a cloud environment with:
- A jumphost with public IP (VM1) serving as a load balancer.
- Multiple private web servers (VM2, VM3, VM4) connected via a private network.
-
Configure Environment: Use Ansible to:
- Install and configure Nginx on the jumphost as a load balancer.
- Install and configure Nginx on web servers to serve static content.
- Set up secure and consistent configurations across all VMs.
.
├── README.md # Main project README
├── terraform/ # Terraform project for infrastructure provisioning
│ ├── README.md # Terraform-specific README
│ ├── main.tf # Terraform configuration file
│ ├── variables.tf # Input variables for Terraform
│ └── providers.tf # OpenStack provider configuration
└── ansible/ # Ansible project for configuration management
├── README.md # Ansible-specific README
├── inventory.ini # Ansible inventory file
├── webservers.yml # Playbook for load balancer and web servers
├── files/ # Configuration files
│ ├── nginx_proxy.conf
│ ├── nginx.conf
Follow the instructions in terraform/README.md
to install and configure Terraform.
- Navigate to the Terraform project directory:
cd terraform/
- Initialize Terraform:
terraform init
- Plan and apply the configuration:
terraform apply
Follow the instructions in ansible/README.md
to install Ansible.
- Navigate to the Ansible project directory:
cd ansible/
- Test connectivity to all VMs:
ansible -i inventory.ini -m ping all
- Run the Ansible playbook:
ansible-playbook -i inventory.ini webservers.yml
-
Jumphost (VM1):
- Acts as a load balancer using Nginx.
- Forwards HTTP traffic to the web servers in a round-robin manner.
-
Web Servers (VM2, VM3, VM4):
- Serve the same static HTML content.
- Are accessible only from the private network.
You can test the setup by accessing the public IP of the jumphost.
-
Terraform Issues:
- Ensure your OpenStack credentials are correctly set in
providers.tf
. - Check for typos in the
variables.tf
file.
- Ensure your OpenStack credentials are correctly set in
-
Ansible Issues:
- Verify SSH access to all VMs.
- Check that
nginx
is running on all servers.
-
Network Issues:
- Ensure that security groups allow the necessary traffic:
- Port
22
for SSH. - Port
80
for HTTP.
- Port
- Ensure that security groups allow the necessary traffic:
Refer to the individual README files for more detailed troubleshooting steps.
This project provides a modular and automated approach to cloud environment setup and configuration, making it scalable and reusable for various use cases.