Code Monkey home page Code Monkey logo

terraformansiblegeneral's Introduction

Create a general purpose host in AWS with Terraform and Ansible

Use Terraform to create:

  • An EC2 instance
  • A security group to allow SSH from anywhere
  • A Route53 domain entry for the host
  • Save outputs in output.json for use with Ansible

Use Ansible to:

  • Set the hostname of the new instance
  • Install required packages
  • Create the current local user, apply public key, and add to sudoers on the remote host

Requirements:

  • Install ansible, terraform, and python packages aws and boto
  • Ansible and Terraform are in the path
  • An AWS access_key and secret key, configured in the aws package
  • An ssh key-pair, already added to this users ssh (the current user needs to ssh to ec2-user)
  • A route53 zone id - The zone must already exist, this scipt will just add an entry for the new host in the zone.

There are multiple ways to complete all the above requirements.

To create your host:

  • Edit the ./terraform/terraform.tfvars file with your variables
  • Run ./terraform/create_inventory.sh, this also creates the output.json which the ansible step will use
  • Run ./ansible/apply_configuration.sh

After the above steps have run you will be able to ssh as the current user to the newly created remote host:

ssh {hostname from terraform.tfvars}.{route53 domain name}

terraformansiblegeneral's People

Contributors

ryanbeales avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.