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.
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.
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)
The Module is a set of commands or instructions that can be execute on client side systems (Node)
A task is a section where provide single procedure to complete using playbook
The process of organize task and related files to be later called in a playbook
Fact fetches the details of client computers by using global variables
In inventory file store the details information of client computers.
Execution of a playbook
It is used as a notifer
The section used as a notifier to completed task in task section.
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
After create account successfully login into account and subscribe ansible using following link “try it free”
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
[ clients ]
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-copy-id -i [email protected]
# ssh-copy-id -I [email protected]
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
# 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.