Skip to content

jimmycgz/terraform-ansible-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform+Ansible Example

This repository is the near-simplest example of deploying an provisioning a web server on Amazon Web Services (AWS), using Terraform and Ansible. Based on:

Details

This repository sets up:

  • A VPC
  • A subnet
  • An internet gateway
  • A security group
  • An SSH key pair
  • A publicly-accessible EC2 instance
  • Within the instance:
    • Python 2 (for Ansible)
    • Nginx

Setup

  1. Install the following locally:
  2. Set up AWS credentials in ~/.aws/credentials.
  3. Ensure you have an SSH public key at ~/.ssh/id_rsa.pub.

Usage

export AWS_DEFAULT_REGION=us-east-1

pip install -r requirements.txt

# run below script to execute terraform and ansible
./deploy.sh

More information about the AWS environment variables. If it is successful, you should see an address printed out at the end. Visit this in your browser, and the page should say "Welcome to nginx!"

Notes

Cleanup

cd terraform
terraform destroy

About

Terraform+Ansible Example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • HCL 88.0%
  • Shell 12.0%