Skip to content

Provisioning a basic load-balanced secure app server in Digital Ocean cloud using Terraform

Notifications You must be signed in to change notification settings

sahil-sagwekar2652/digitalocean-vpc-terraform-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digital Ocean VPC using Terraform and Ansible

My Skills

Digital Ocean VPC

Usage

  1. Ubuntu/Debian
  2. Mac

Requirements

  • Digital Ocean personal access token

  • SSH public key id_rsa.pub at ~/.ssh/id_rsa.pub

  • *.tfvars file should look like this -

do_token = "your digital ocean private access token"

How to Run

  • First, terraform apply
terraform apply
  • Save the output
terraform output -json > ansible/output.json
  • Now to run the ansible playbooks, let's cd into the ansible/ directory
cd ansible
  • Run this playbook to configure the NAT gateway
ansible-playbook nat_gateway.yaml
  • Run this playbook to setup the app servers
ansible-playbook app_config.yaml
  • Go back to the project root folder
cd ..
  • To test the vpc you can run the test-run.sh script (inside the project root dir) which will curl the loadbalancer
chmod +x scripts/test-run.sh
./scripts/test-run.sh
  • The output should demonstrate the Round Robin algorithm in action.

Note

If you are on a Mac, chances are that the sed command works differently to the Linux version of sed

To avoid any issues, follow these steps to install gnu-sed in your command line.

brew install gsed

and add this to ~/.zshrc in your mac

PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"

References

About

Provisioning a basic load-balanced secure app server in Digital Ocean cloud using Terraform

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published