Ansible is one of the very popular free and open source configuration management tool, It provide automatic configuration management on client systems (nodes).
It can manage hundreds of system simultaneously or concurrently, it make system/network administrator task very easy to manage number of system at a time. Ansible can be easily configure Linux, Unix, Mac, Windows Operating Systems, ansible also have own declarative or human understandable programming language for the node configuration and management.
Ansible is very easy and simple for installation, easy to connect with client (node) computers to manage auto-configuration. Ansibler server store client (node) details in /etc/ansible/hosts file that file is called inventory file, in this file store client details such as group name ,ip address, hostname etc. System admin can configured setting, configuration on multiple client at a time, so it make configuration on number of client very easy, minimise required time or extra effort to manage target node system. We can provide instruction to target system with help of short command as well as with help of scripting book, which is very easy for administrator to provision control and monitor large number of system.
For example:
Think as a system admin, you need to check free or available memory on your all systems then what option you have?
- You need to go each and every system login and check available memory.
- You can use remote access like SSH, but need to login each and every system to check free memory.
Both options are very time consuming required more effort.
But if you have ansible configured you got all system RAM details within few sec with help of one command.
That the reason why ansible is very popular in market
History of Ansible:
Ansible project start Feb 2012, Ansible was developed by Michael DeHaan, he is also creator of Cobbler and co-founder of Fedora Unified Network Controller framework for remote administration.
Initially AnsibleWorks Inc, funding company of ansible project which was founded in 2010 by Michel DeHaan with few partners, but it acquired by Red Hat in Oct.2015. Today ansible comes with various linux distributions like RHEL, CentOs, Fedora, Oracle Linux etc.
For Free, Demo classes Call: 9028513226
Registration Link: Click Here!
Advantages of Ansible:
- Free and open source
- Simple and easy configuration
- Human readable automation
- No special coding skill required
- Task executed sequentially
- Strong security
- No agent required on node system
Why Ansible Popular:
In market so may Auto-Configuration Management tools are available such as puppet,chef but ansible one of the leading tool for the auto-configuration management because ….
- Ansible free and open source
- Ansible use ssh protocol to control node (client)
- Ansible does not required any agent tool on node system
- No agent so ansible use little resource of CPU and RAM.
- Ansisble can work on cross platform.
- Ansible is very lightweight and consistent
Important concepts used in Ansible :
- Ansible server
The system on which we install the ansible tool from where we run and execute all task on client side systems. (Node)
For Free, Demo classes Call: 9028513226
Registration Link: Click Here!
- Module:
The Module is a set of commands or instructions that can be execute on client side systems (Node)
- Task:
A task is a section where provide single procedure to complete using playbook
-
Role:
The process of organize task and related files to be later called in a playbook
-
Fact:
Fact fetches the details of client computers by using global variables
-
Inventory:
In inventory file store the details information of client computers.
-
Play:
Execution of a playbook
For Free, Demo classes Call: 9028513226
Registration Link: Click Here!
-
Handler:
It is used as a notifer
-
Notifier:
The section used as a notifier to completed task in task section.
-
Tag:
It assigns the name to task.
Steps for install Ansible on Red Hat Enterprises Linux 8:
step1: Install ansible by using redhat subscription manager
Create account on red hat subscription manager using following link
https://www.redhat.com/wapps/ugc/register.html?_flowId=register-flow&_flowExecutionKey=e1s1
After create account successfully login into account and subscribe ansible using following link “try it free”
https://docs.ansible.com/ansible/2.4/redhat_subscription_module.html
For Free, Demo classes Call: 9028513226
Registration Link: Click Here!
step2 : Login subscription account using terminal
Login into system and open terminal
# subscription-manager register
Type authentication of red hat subscription manager account
username : —-
password : —-
step 3: Check subscription manage list set pool id and enable repository
# subscription-manager list –available
# subscription-manager attach –pool <Pool ID>
# subscription-manager repos –enable ansible-2-for-rhel-8-x86_64-rpms
# yum install ansible
Step 4: Create inventory file to store client details
#vim /etc/ansibe/hosts
[ clients ]
192.168.1.10
192.168.1.11
:wq
Step 5: Verify Ansible install successfully or not
# ansible –version
Step 6: Start and enable ssh service (ansible use ssh service by default)
# systemctl start sshd
# systemctl enable sshd
# systemctl status sshd
# systemctl restart sshd
Step 6: Generate ssh key and copy it to the remote server
# ssh-keygen
# ssh-copy-id -i root@192.168.1.10
# ssh-copy-id -I root@192.168.1.11
For Free, Demo classes Call: 9028513226
Registration Link: Click Here!
Note: Recommended always use secondary user account on client as well as server to control number of hosts using ansible
Step 7 : use ping module to verify clients are connected with you or not
# ansible -i /etc/ansible/hosts clients -m ping
or
# ansible -i hosts clients -m ping
Here, option -i is mention for the path of inventory file. Hosts is a inventory file and clients is a group name mention in inventory file.
After run above ansible command if result is success then your ansible server and client can connect with each other successfully.
If show any error or unreachable then check one time client is connected or not and also verify ansible server configuration again.
Author:
Abhijeet Dahatonde
Linux Trainer,
SevenMentor Pvt.Ltd.