(IAC) Infrastructure as code in DevOps

SUMIT DESHMUKHSUMIT DESHMUKH
4 min read

Infastructue as code

  1. It means every kind of infrastructure is needed to run an application on server is hand coded by devOps Engineer is called IAC.

  2. DevOps Infrastructure include Ec2 linux Servers, s3 buckets, RDBMS, Dynamo db, VPC etc.

  3. in IAC there are two terms which are very important

    a. Configuration Managment.

    b. Provisioning.

  4. Configuration Managment is the simply managing configuration of infrastructure like if we have three linux server so we have diffrent diffrent tools who take care of these infrastructure like server is getting updated or not time to time if we want to install any software on those server so we well configure them via configuration tools like Ansible, chef , pupet etc.

  5. Provisioning is simply coding to provisioned the infrastructure. So like coding for making the linux ec2 server, S3 bucket etc. there are some provisioning tool like Terraform , cloud formation.

Ansible

  1. Ansible is simply a open souce configuration managment and it manages cross-platform automation and orchestration tool. Command which is executed by the ansible are called Module. All this modules are invoked by tasks and collection of these tasks are called ansible playbook and these playbooks and in the yaml (yet again markup language) format.

  2. Ansible installation you need to have one Master Node who well control the worker nodes so you should have worker nodes and Ansible should be installed in both the master and worker node.

  3. we have to use pip to install Ansible.

     $ sudo apt update
     $ sudo apt install software-properties-common
     $ sudo add-apt-repository --yes --update ppa:ansible/ansible
     $ sudo apt install ansible
    
  4. ansible inventry will contain the worker node ip’s.

  5. There are some Ansible related terms are as followed.

    a. Ansible Server are the servers where ansible is installed and where tasks and module will run.

    b. Module is simply a commands and set of commands used to configure the servers.

    c. Tasks is the kind of single sections that has single procedure to complete on client / worker node.

    d. It is kind of a way to organize all the tasks which is called Ansible Playbook.

    e. Fact is the insformation fetched from the client node server which is gathered by global variable.

    f. Inventry is simply contain the ip’s of the client server.

    g. Play is command to play playbook.

    h. host which are automated by master node.

    I. handler is task which is called when notifier is present.

    j. notifier section attribute to task that called handler when output is changed.

    k. playbook consist of yaml format contain code to describe worker node the task to do.

  6. Ansible Infrastructure has one Master node and Two client / worker node.

  7. Master node has ansible downlode and it has inventry and playbook.

  8. There are two type of configuration managment first is pull base and second push base.

  9. Push base is something that master node sends the command and information to configure the worker node.

  10. pull base means first worker not send information to master node then it do somting about the information and then it configure the worker node.

  11. Ansible is push base and the chef and puppet is pull base configuration managment.

Provisoning of Infrstructure using Terraform

  1. Terraform is open souce tool to provisioned infrastructure which is need for devOps cycle and it is handcoded.

  2. The language called HCL(Hashicorp Language) and Terraform is developed by hashicorp.

  3. There are some termes like blockes and provider.

  4. blockes are simply which contain the providers like aws, azure, gcp etc.

  5. There are different types blockes like resource block.

There is one term called Terraform staging which is very important

1. Terraform Stage file is the json file that manage and track the resource managed by Terraform

One more is called Terraform module

  1. Modules are containers for multiple resources that are used together. A module consists of a collection of .tf and/or .tf.json files kept together in a directory.

    Modules are the main way to package and reuse resource configurations with Terraform.

0
Subscribe to my newsletter

Read articles from SUMIT DESHMUKH directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

SUMIT DESHMUKH
SUMIT DESHMUKH

I am a student at AITR indore. I am learning devops as well with my studies.