Ansible IT Infrastructure Automation

Let me first focus about what is Ansible

Ansible is mainly used for IT infrastructure management or deploy applications to remote node.

Ansible is open source automation platform, it help user with
configuration management, application deployment or task automation.
With help of Ansible we can deploy an application using Secure shell(SSH) without any downtime.

In which language Ansible is written- Python language

1. Why Ansible is so popular:

1. No Agent Require: It mean no agent application is required for setting up Ansible.Basic requirement of Ansible is machine should support SSH and it should have python packages.
2 Idempotent: Ansible is totally structured around the concept of idempotent.
3. Declarative not procedural: Ansible we need to write the description of the state machine which we want and it takes proper step to full fill that task.
4 Easy to lean

2. What Ansible can do

Ansible can able to handle more that 100 node in a single system over SSH connection and only one single command Ansible playbook.

Basically it have two concept one is server controller machine and another are nodes that controller need to connect. Other machine we no need to install any software applicaiton, it can be controller from host machine only.

Let me quick start how we can configure Ansible in linux host machine:-

Step 1:
Installation or configuration Ansible, for that we need to copy yum repository from internet

      # yum install epel_release

this command copy yum repository package and help to install ansible in redhat 7 linux.

Step 2: After that install Ansible by below command

      # yum install ansible

Verify configuration file go to /etc/ansbile folder

From above two command you will able to install ansible in linux box, now our target is to mange our infrastructure
from ansible.

Step 3:-
Before more forward we need to understand how ansible discover node or client machine. So to make node discover in some configuration file we need to specify the list of node machine hostname or ip address as per the user categorization task of machine.

For that we can specify the client machine hostname or ip in file

   #  vim /etc/ansbile/hosts

where user need to specify hostname or ip.

Step 4: Verify client machine is reachable of not with help of below commands.

   # ansbile -m ping all

If we got success full ping response it mean machine is reachable from ansbile host machine and we can controll client machine

Step 5: Let check client machine statistics from ansible commnad.

    # ansbile  -m command -a 'free -m'  all
    # ansble   -m command -a 'df -TH'   all

Step 6: Let me quick explain how we can start and stop services network.

    # ansible -m command -a 'systemctl restart network' all

It will restart all network service that are mention in host machine

Leave a Reply

Your email address will not be published. Required fields are marked *