The software development industry has grown over the years, from simple software running in one machine to complex systems on multiple servers in the cloud. Provisioning and handling complex server architecture across different environments can be a big test.
Users would manually provision servers, install all the dependencies, and then launch the software. This approach has defects. Assuming that the user’s infrastructure gets corrupted or flops, to spin new servers the user will have to go through the same painful process all over again. Isn’t it frustrating?
INFRASTRUCTURE AS CODE (IAC)
Infrastructure as Code (IaC) is the process of handling and provisioning computing and networking infrastructure and their configuration through machine-processable code, rather than physical hardware configuration or the use of interactive configuration tools. Such files can be kept in source control to allow audibility and reproducible builds and the full discipline of continuous delivery.
There are many tools that are used to achieve this such as, terraform, Puppet, Chef, Ansible, and much more. However, in this article, we will be looking into Ansible.
Ansible is an open source automation platform which is used for configuration management, application deployment, and task automation. It can also do IT orchestration to run tasks in order and create a sequence of events which must happen on several different servers or devices. In short, Ansible enables the user to define the infrastructure as code in a simple declarative manner.
When it comes to choosing a tool, there is always a question, why should anyone use it? What is the deal breaker? There are many reasons why to choose Ansible as your configuration management tool. Here are some of them.
IT IS AGENTLESS
As compared to Chef or Puppet, Ansible does not make use of the agent in the remote host rather it makes use of SSH to manage the systems. This is a good news as the user need not to configure anything on the host before they use it. This approach makes it simpler to set up and to use.
Ansible makes use of ad-hoc mode to run shell commands across different machines. This can come in handy if the user is providing many servers. This also minimizes the provision time to make it easier and quicker to replicate the user’s infrastructure.
It is recommended to name all the Ansible tasks in a very eloquent manner in the user provisioning script. When the script is executed, Ansible will provide descriptive reports whether the task is succeeded with or without changes. The messages are also coloured providing orderly reports.
EASY TO USE
Ansible uses YAML as its configuration syntax. This makes it easy to the user as compared to using a bash script. Taking into consideration that YAML is easy to learn, therefore reduces the learning curve.
Of course yes, the user need to start by installing Ansible. Tasks can be run in any machine where Ansible is installed.
As Ansible is “agentless” there is no central agent running. The user can even run Ansible from any server.
Here is how to install Ansible on Ubuntu 14.04.
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible
Ansible is an open-source automation engine that automates cloud provisioning, configuration management, and application deployment. It provides an easy way for the users to manage their infrastructure through easy human readable syntax. The concepts we have looked at in the above sections is a mere drop in the ocean, they are only guidelines to get you started. So it is up to the user to take the step further and discover what Ansible has to offer.