-
This project is a demonstration of how to use Terraform and Ansible to create a VPC with 4 subnets, 2 availability zones, 2 public and 2 private subnets, a bastion host, 2 private instances, a NAT gateway, an internet-facing load balancer and then configure the private instances with nexus, postgresql, and sonarqube
-
ansible folder consists of playbook.yaml, inventory.txt, and roles folder
-
roles
- nexus
- postgresql (sonarqube requirement)
- sonarqube
-
versions of the abovementioned roles can be edited through roles/required-role/vars/main.yml file
Before you begin, ensure you have met the following requirements:
- You have installed Terraform and Ansible
- You have an AWS account with administrative access
- config ~/.ssh/config to include your bastion host data as follow
Host bastion
hostname bastion_public_ip
user ubuntu
port 22
identityfile /path/to/bastion/key.pem
- clone the project
- in terraform folder, init and apply
- use public ip address and private ip addesses in all-ips.txt file (generated from terraform) to create your inventory ansible file
- in ansible folder, run ansible-playbook playbook.yaml -i inventory.txt
- I have created AWS ALB rules manually
- These photos are taken before automating infra creation using terraform
- created ec2 instances
- target groups, btw autoscalling groups will be simillar to them
- created internet facing load balancer, can be used as reverse proxy for private instances 😉
- load balancer listener routing rules
- default load balancer page
- routed sonarqube page
- routed nexus page







