$ git clone https://github.com/LandmakTechnology/k8s-ansible.git
$ cd Kuberentes_Cluster_Terraform_Ansible
Update Your Key Name in variables.tf file before executing terraform script
Infrastructure As A Code
Create Infrastructure(VPC,Subnets,Route Tables,EC2 Instnaces ..etc) As A Code Using Terraform Scripts
# Initialise to install plugins
$ terraform init terafrom_scripts/
# Validate teffaform scripts
$ terraform validate terafrom_scripts/
# Plan terraform scripts which will list resouce which will be created
$ terraform plan terafrom_scripts/
# Apply to create resources
$ terraform apply --auto-approve terafrom_scripts/
Configuration Management
Check If DynamicInventory Script works.
$ chmod +x DynamicInventory.py
#Add default Region so that DynamicInventory will fetch host details from that Region.# temporally
$ export AWS_DEFAULT_REGION=ca-central-1
# Or Permanently#Create config file in current user .aws folder And below content.
$ mkdir ~/.aws
$ vi ~/.aws/config
[default]
region=ap-south-1
$ ./DynamicInventory.py --list
Kubernetes Cluster Setup Using Ansible (Configuration Management) With DynamicInventory.
Create a pem file and copy aws private key(pem) file content which you used in terraform.
$ vi DevOps.pem
$ chmod 400 DevOps.pem
Replace <Pemfile> with your pemfile path in server