-
Create tf directory to house tf files
mkdir terraform ansible
-
Switch to terraform directory, create empty tf files and begin to add necessary code to build out infrastructure
cd terraform; touch ec2.tf variables.tf vpc.tf provider.tf
-
Once infrastructure is deployed ssh into the server to create the directory Ansible & the yml files that will be executed
ssh -i (key_file created in tf code) ubuntu@public_ip; mkdir Ansible; touch packages.yml main.yml users.yml groups.yml
-
Install Ansible onto server
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
-
Run command
ansible-playbook main.yml
to push tasks on localhost
-
Notifications
You must be signed in to change notification settings - Fork 0
holland97/EC2-Terraform
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Use terraform to create a vpc with everything that encompasses it, deploy an ec2 instance, and use ansible to push commands on local server
Topics
Resources
Stars
Watchers
Forks
Packages 0
No packages published