We are using terraform for provisioning the intrstructure which include; VPC, Internet Gateway, RT, Servers (Ansible, Jenkins)
# Create a REDHAT EC2 instance in aws cloud and assigned IAM roles
AmazonEC2FullACCESS
AmazonVPCFullACCESS
$ sudo useradd ansible
$ echo "ansible ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ansible
$ sudo su - ansible
# Enable PassowrdLogin and assign password to ansible user
$ sudo yum install python3 -y
$ sudo alternatives --set python /usr/bin/python3
# Install pip package manager for for python
$ sudo yum -y install python3-pip -y
$ pip3 install ansible --user
# install boto aws python SDK use to manages resources in aws cloud
$ pip3 install boto3 --user
$ sudo su ansible
sudo yum install wget git unzip -y
wget https://releases.hashicorp.com/terraform/0.12.26/terraform_0.12.26_linux_amd64.zip
sudo unzip terraform_0.12.26_linux_amd64.zip -d /usr/local/bin/
#Export terraform binary path temporally
export PATH=$PATH:/usr/local/bin
#Add path permanently for current user.By Exporting path in .bashrc file at end of file.
$ vi .bashrc
export PATH="$PATH:/usr/local/bin"
# Source .bashrc to reflect for current session
source ~/.bashrc
git clone https://github.com/LandmakTechnology/Terraform-Ansible-k8s-Automation.git
cd terraform-ansible-k8s-automation
# 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/
$ chmod +x DynamicInventory.py
$ ./DynamicInventory.py
# Ansible command to setup k8s cluste using DynamicInventory.
###### <span style="color:red">Replace \<Pemfile> with your pemfile path in server </span>
```sh
$ ansible-playbook -i DynamicInventory.py site.yml -u ubuntu --private-key=<PemFilePath> --ssh-common-args "-o StrictHostKeyChecking=no"
$ terraform destroy --auto-approve terafrom_scripts/
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.