Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 1.07 KB

README.md

File metadata and controls

46 lines (37 loc) · 1.07 KB

Multiple EC2 Ubuntu Instances Deployment and Provisioning with Terraform & Ansible

  • Automatically populate Ansible's inventory post-deployment

  • Uses locally generated elliptic curve key-pairs

  • Currently only installs Nginx (adjust if needed)

Requirements

make sure all three are installed on your system:

  • AWS cli
  • Terraform
  • Ansible
  • JQ to parse JSON

Procedure

  1. Create your key-pair locally.
    # create your key-pair
    ssh-keygen -t ed25519 -C ubuntu
  1. Give the private key proper permissions
    #  Make sure the key is not too open
    chmod 600 ~/.ssh/ansible-key
  1. Export Ansible's config file to prevent ssh from checking our key.
    # export Ansible's config file
    export ANSIBLE_CONFIG=./ansible.cfg
  1. Initialize Terraform.
    # run terraform init
    terraform init
  1. Deploy.
    # run terraform plan or terraform apply
    # don't forget to adjust the variables before doing so
    terraform apply --auto-approve