Integrating Ansible With AWS Resources.

  • Here you can see in my localhost i.e Ansible Controller Node “aws” command is not present. so for installing it, we can run “pip3 install awscli” and afterward we have to configure the credentials by running “aws configure” command. These are the basic pre-requisites before deploying the playbook. but I have also written a play for the same.
  • Now “aws” command is working fine.
  • For configuring credentials we have to run “aws configure” command.
  • “ansible — version”: this command shows the details about ansible version, config file etc.
  • Here you can see I am in the “Ansible-Project” directory, which contains ansible.cfg, inventory.txt, playbook.yml files, and ansible-eks role.
  • “ansible-galaxy role list”: This command list the roles.
  • Here you can see I am inside the role.
  • List of Modules that I have used in Role: pip, Blockinfile, ec2_vpc_net, ec2_vpc_subnet, ec2_vpc_igw, ec2_vpc_route_table, ec2_group, iam_role, aws_eks_cluster, yum_repository, package, command.
  • Explanation of Files that I have used in Role:
  • Explanation of Important Variables that I have used in Role:
  • So here you can see in my localhost: boto library is not present.
  • So here you can see in the above images: I don’t have any VPC, Subnets, Internet Gateway, Route Table, security groups, EBS volumes, Roles, EKS Cluster, and EC2-Instances. Only default: VPC, Subnets, IGW, Route Table, Roles are available.
  • Here you can see a client-side command for Kubernetes that is kubectl is not present in my localhost host and even repo for k8s is not there.
  • In .kube/ directory there is no config file for kubernetes.
  • So here you can see playbook is successfully deployed.
  • Here you can see now boto and boto3 libraries are successfully installed.
  • VPC: myvpc is created.
  • Subnet: Subnet1 and Subnet2 are created.
  • Internet Gateway: IGW is created.
  • Route Table: Public Route Table is created which is associated with IGW and Public Subnets.
  • Security Group: Sg for eks is created with inbound port 22, 80, 3306.
  • Two roles are created Successfully.
  • EKS Cluster created with node group that contains three worker nodes.
  • Here you can see two dynamic PVC are created, one is allocated with WordPress pod and another one is allocated with MySQL pod.
  • So here you can see the config file for Kubernetes EKS Cluster is updated now.
  • Kubernetes repo is created and now kubectl command is working.
  • Here you can see three worker nodes are running.
  • Here you can see the secret has been created.
  • Here you can see AWS-EBS storage class has been created.
  • Here you can see PV and PVC are created.
  • Here you can see WordPress and MySQL pod are running where WordPress pod is exposed to the outside world with AWS load balancer. so if I hit to load balancer DNS, I will redirect to the WordPress site.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Everything about Huawei Geofence Service

Step One of the Fonk Development Process

BOD Deck Post Mortem

Decentralized Application (dApp) — Is this futuristic?

clarisco-decentralized application

Say “Hello” to the Revolutionized Git Integration with APICTL 4.0.0

ASP.NET Boilerplate Solution: Pellerex is Beyond!

Structure of CloudFormation Template

PWA vs Native apps: review of key factors and differences

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aaditya Tiwari

Aaditya Tiwari

More from Medium

How to Configure Terraform on Windows?

What is terraform?

Beginners Guide to Terraform

Getting started with Terraform on AWS