Skip to content

SHrEE-7/Jenkins-Setup-using-Ansible-and-Terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Terraform + Ansible Setup

Terraform official doc https://registry.terraform.io/providers/hashicorp/aws/latest/docs

Launch Amazon-Linux instance for Terraform & Ansible Installation (Master Instance)

  1. Launch Amazon-Linux instance
  2. install terraform --> https://developer.hashicorp.com/terraform/downloads
  3. install ansible yum install ansible
  4. install aws-cli and setup the credentials for IAM user
aws --version
aws configure 
aws configure list

Launching slave instance from terraform

  1. copy the terraform-AL2-launch folder into the master instance
cd terraform-AL2-launch
  1. execute below command to get neccessary dependancies for provider to run terraform script
terraform init
  1. check terraform syntax
terraform plan
  1. Create resources present in terraform script
terraform apply / terraform apply -auto-approve
  1. Destroy created resources
terraform destroy

Copy slave pem file to master instance

we have manually created secret key to ssh into the slave instance. This needs to be copied to master instance so that master can access slave

  1. Enable PasswordbasedAuthentication in master instance
  2. command to copy the pem file from local to master instance
scp Server-Key-Pair.pem [email protected]:/root   
  1. connect to master instance & move Server-Key-Pair.pem to .ssh folder
mv Server-Key-Pair.pem .ssh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published