Introduction to Ansible
Ansible is an open source automation framework (or platform) used for IT tasks such as the deployment of software, configuration management, orchestration of infra services and supply. Automation is crucial today, with overly complex IT environments that often need to be scale-up too quickly for system managers and designers to keep abreast of everything manually. The automation simplifies complex tasks, allowing developers to concentrate on other tasks that add value to an organization, and not just make developer jobs better managed.
It is simple, powerful and agentless. The biggest differentiator between ansible and other tools lies in the architecture, it works on “Push” model i.e. no additional software is required to be installed in the server. By default it manages remote connections over SSH (Linux & Unix) or WinRM (windows).
Below is this architecture diagram of Ansible
Let’s see the functionality of the individual components in detail.
Ansible automation engine encompasses an Inventory, API, modules, and plugins.
Ansible Playbook: It leverages the playbook for automation and orchestration of IT infrastructure. This playbook consists of automation task that serves as an input to the ansible automation engine which describes how a particular piece of automation will work.
This playbook consists of a series of “play” which defines the automation task across a set of hosts known as “Inventory”. Each ‘play’ consists of multiple tasks that can serve one or more host present in the inventory. All these tasks made a call to an Ansible module, which is a small piece of code that performs a specific task.
A typical example of a task could be installing any software or placing a configuration file in the server. A more complex task could be spinning up the entire Cloud Formation infrastructure in Amazon EC2.
It comes with hundreds of module ranging from managing network devices, simple configuration management, to modules for maintaining infrastructure on every cloud provider.
These modules are designed in such a way that it first checks whether the task needs to be executed or not, for instance, if an ansible task is to start a Tomcat server then the task will only get executed if it is not running already. This phenomenon is termed as “Idempotency” which allows executing configuration repeatedly without any mayhem.
These playbook tasks can also be reused, these reusable units are called “Role”. These roles can be easily leveraged to perform redundant tasks such as to apply common server configuration across development, UAT and production server.
What can you do with Ansible?
With this, you can automate the below-mentioned tasks. let’s see some particle example to understand it in an easy way.
Let’s assume you have a java web application that needs to be deployed in multiple server i.e. dev, UAT and prod. In order to deploy the war file, first, you need to set up the web server and database server in all the machine. Also, the same SQL scripts need to run in all the database to set up the database. Now it doesn’t make sense to perform this redundant task manually.
With this all you need to do is to write simple tasks in playbook and Ansible will perform these redundant tasks for you.
Unlike puppet & chef (automation tool like ansible) which requires the knowledge of ruby, with ansible you don’t need to learn any complicated programming language. Ansible uses YAML which is high level human readable language that can be easily understood by IT Admin. Also, most of the common tasks are available in the form if playbook in the Ansible Galaxy Community which you can extend as per your requirement.
Why should we use Ansible?
So far we have talked about what Ansible is capable of. Now let’s see why we should make use of Ansible in our projects.
- Using this you can cut down certain processes from hours to minutes.
- It eliminates repetitive tasks
- It saves time and improves productivity.
- Fewer mistakes and error.
- Increase accountability and compliance.
Who is the right audience for learning these technologies?
You must be thinking that this technology is related with the IT Infrastructure and Maintenance which usually taken care by the IT Admin or the deployment team and you being a developer doesn’t need to understand this but let me break this stereotype. As you know that in DevOps development and operations work is integrated, it provides a stable environment for both development and operations. Thus it is important that a developer must understand the task written in the playbooks and if there is any change in the development environment he/she should be capable to make changes in the playbook for other environments accordingly for a smooth orchestration of the application lifecycle.
How this technology will help you in career growth?
It is must-have technology in your resume. Nowadays, every other company is trying to automate all the processes they can to increase the overall productivity and efficiency of the application and resources. Enterprise applications which typically deployed in different servers across the globe require constant server configuration and management which requires a good amount of time and efforts. If you have very good knowledge of automation tool like Ansible and able to write playbook to automate this redundant task, this will definitely set you apart and helps you in your career growth.
After reading this article you must have got a clear understanding of what Ansible is, what ansible is capable of and how can you improve the overall efficiency and productivity in your project by implementing Ansible. If you want to go deep in this topic you can check the white paper and sample playbooks available at the official Red Hat Ansible website.
This has been a guide to What is Ansible. Here we discuss the working of Ansible and also how and where it can help in career growth. You can also go through our other suggested articles to learn more –