Ansible
What is Ansible?
Ansible is an open-source IT automation tool that automates configuration management, application deployment, and many other manual IT processes.
Unlike more simplistic management tools, Ansible users (like system administrators, developers and architects) can use Ansible automation to install software, automate daily tasks, provision infrastructure, improve security and compliance, patch systems, and share automation across the entire organization.
In big companies, there are thousands of servers that need to be configured daily. Now imagine if we have to go and configure that each server manually by going to that particular pc or computer, how irritating and time-consuming it would be And that is the reason why ansible was created. Ansible allows you to configure multiple apps and files at one time from one single computer/server using Infrastructure as code.
The server which has ansible installed is known as the Control node/server while the remote hosts/servers which are configured are known as Managed server
In ansible, you have two things to configure nd that are : -
- Ad-hoc commands (Command-line)
- Playbooks
1) Name of the play.
2) Hosts
3)Tasks.
The format used for writing playbooks is YAML.
Inventory~ File containing data about client server.
The remote servers or hosts which need to be configured are in the Inventory.
Things to do while using ansible.
- Creating Host server.
- Install Ansible to Host server.
- Creating 2 more EC2 instances (servers)
- Add these EC2s to inventory file.
- Configure the servers using command method.
- Uses of playbooks.
- Deployment of a simple webpage using Ansible.
First of all we have to create 3 EC2 instances. we have to make sure that all three instance are created with same key pair. Our one server would be host server where we perform all the tasks and rest are other servers.
STEP2
Now we will have to install Ansible in host server (Ansible_host). You can follow the followings commands to install Ansible.
sudo apt update
sudo apt install ansible
In this step we will learn about role of playbooks in ansible.
Now we will run this playbook by using ( ansible-playbook <<name of play book>> ) .
so, as we can see in above screenshot that (create a file) is installed in both the server. so, it’s time to ssh one of the server and check whether (create a file) is installed or not.
THANK YOU
— Saurav Kumar
Comments
Post a Comment