What is Ansible?
It is an open-source software provisioning, configuration management, and application-deployment tool.
It is mainly used for the automation of cross-platform computer support tasks. It is fundamentally intended for IT professionals, who use it for configuration management, cloud provisioning, application deployment, intra-service orchestration, updates on workstations and servers, and nearly for anything a systems administrator does on a day-to-day basis. Ansible doesn’t depend on agent software and, most importantly, no additional custom security infrastructure, so this makes it easy to deploy. It uses a straightforward language (YAML, in the form of Ansible Playbooks) that allows people to use it to describe automation jobs.
History
The word “ansible” was coined by Ursula K. Le Guin in his 1966 novel Rocao’s World, and refers to fictional instantaneous communication systems.
Ansible was developed by Michael DeHaan, author of Provisioning Server Application Cobbler, and co-author of the Fedora Unified Network Controller (Func) Framework for Remote Administration.
Ansible, Inc. (Originally AnsibleWorks, Inc.) The company was founded in 2013 by Michael DeHaan, Timothy Gerla and Sad Zioni to support and sponsor Ansible commercially. Red Hat acquired Ansible in October 2015.
Why do we use Ansible?
There are many advantages of Ansible that we use like:
- Infrastructure Scaling: when you are handling a large number of servers for configuration and want to make sure that configuration is precisely done & fast too.
- Agentless: There is no requirement for the agent to be installed on the server to work with Ansible. It uses ssh and python to establish connections with the server.
- Modular: It uses modules for configuration management, and there are more than 750 built-in modules available, making it easy to handle configure management.
- Performance: It has very little latency that enhances the performance.
- Low Overheads: There is no requirement of agents and tools that leads to saving a lot of space and low overhead in terms of deployment.
- Simple: as it uses Yaml, which is an English-like language & easily understandable.
Features
Ansible uses no extra functionality and cost like no agents and no extra custom security infrastructure, hence it is easy to deploy.
Ansible uses a very simple language called YAML (Yet Another Markup Language) in the form of Ansible Playbooks and you can configure it as per your requirement, and it helps describe the automation jobs in a way that looks like basic English.
The Ansible Automation Engine has a direct interaction with the users who write playbooks and also interacts with cloud services and the Configuration Management Database (CMDB).
Founder of Company.
Michael DeHaan
Ansible components
- Inventory: The “inventory” is a configuration file where you define the host information. In the above /etc/ansible/hosts example, we declared two servers under test-hosts.
- Playbooks: In most cases – especially in enterprise environments – you should use Ansible playbooks. A playbook is where you define how to apply policies, declare configurations, orchestrate steps and launch tasks either synchronously or asynchronously on your servers. Each playbook is composed of one or more “plays”. Playbooks are normally maintained and managed in a version control system like Git. They are expressed in YAML (Yet Another Markup Language).
- Plays: Playbooks contain plays. Plays are essentially groups of tasks that are performed on defined hosts to enforce your defined functions. Each play must specify a host or group of hosts. For example:
– hosts: all
- Tasks: Tasks are actions carried out by playbooks. One example of a task in an Apache playbook is:
– name: Install Apache httpd
- Roles: A role is the Ansible way of bundling automation content and making it reusable. Roles are organizational components that can be assigned to a set of hosts to organize tasks. Therefore, instead of creating a monolithic playbook, we can create multiple roles, with each role assigned to complete a unit of work. For example: a webserver role can be defined to install Apache servers.
- Handlers: Handlers are similar to tasks except that a handler will be executed only when it is called by an event. For example, a handler that will start the httpd service after a task installed httpd. The handler is called by the [notify] directive. Important: the name of the notify directive and the handler must be the same.
- Templates: Templates files are based on Python’s Jinja2 template engine and have a .j2 extension. You can, if you need, place contents of your index.html file into a template file. But the real power of these files comes when you use variables. You can use Ansible’s [facts] and even call custom variables in these template files
Advantages of Ansible
- Easy-to-Learn: The simplicity is not only meant for professionals but also for beginners. It is easy to learn, and so, users could learn to use Ansible quickly along with better productivity. Ansible receives the support of comprehensive and easily interpretable documentation.
- Written in Python: The next important addition among the benefits of Ansible. Ansible manages all the master-agent communications through Standard SSH or Paramiko module. The Paramiko module is a Python implementation of SSH2 and is crucial for managing nodes. Therefore, Ansible does not require any form of agents installed on remote systems for ensuring management. As a result, maintenance overheads and performance degradations reduce considerably by huge margins with Ansible.
- Not dependent on agent: The most important advantage of Ansible refers to its agentless nature. Ansible manages all master-agent communication via standard SSH or Paramiko modules. The Paramiko module is a Python implementation of SSH2 and is important for managing nodes. Therefore, Ansible does not require any form of agents installed on the remote system to ensure management. As a result, maintenance overheads and performance degradation are significantly reduced with Ansible by a large margin.
- YAML-Based Playbooks: Ansible Configuration Files—are written in YAML, which is better suited for configuration management and automation purposes than other formats like JSON. It’s easy to read, supports comments, and uses anchors to reference other objects.
- Ansible Galaxy: Ansible Galaxy is a portal that acts as the central repository for locating, reusing, and sharing Ansible-related content. The best advantage of Ansible Galaxy is in the example of downloading reusable Roles for installing application or server configuration.
Alternatives of Ansible
- Rudder.
- SaltStack.
- Puppet Enterprise.
- Chef.
- CFEngine.
- Gitlab CI.
- Jenkins.
Interview Questions and Answers
Best Tutorials and Guide for Ansible
Best Courses and Insitute for learning
If you want certification course for such top course. So please visit “Devopsschool.com”. You will find more certification courses here.
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024
Ursula Le Guin was a she, not a he! And the novel is
Rocannon’s World, which was her first published novel.