DevOps is a culture where everyone in an organisation gets engaged with each other to achieve the common goal of ensuring faster and smoother software/product delivery. By each passing day DevOps is gaining great acceptance amongst the industry players at different levels whether it's a big enterprise or a startup company.
Along with that the Infrastructure as Code (IaC) solutions aka configuration management and orchestration tools such as Ansible, Puppet and Terraform are also witnessing a huge demand and popularity.
All these tools helps in deploying applications and infrastructure. Ansible and Puppet are the tools for configuration management (abbreviated as CM) whereas Terraform is a service orchestration and provisioning tool.
Let's go through their official definitions.
What is Ansible?
As per official documentation Ansible is an IT automation tool. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates.
What is Puppet?
As per official documentation Puppet is the industry standard for IT automation. Manage and automate more infrastructure and complex workflows in a simple, yet powerful way.
What is Terraform?
As per official documentation Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.
Before we dig deeper we must understand the terms Orchestration and Configuration management.
What is Orchestration and Configuration Management?
Orchestration it is mainly concerned with automating the execution of a workflow – of a process. Simple automation can't get you process optimization. Orchestration tools such as Terraform can be used for not only just server provisioning, but also other tasks such as databases, caches, load balancers, queues, monitoring, subnet configuration, firewall settings, routing rules, SSL certificates, and so on, mainly on public cloud infrastructure. Orchestration tools provides an opportunity to streamline and to optimize deployment processes.
Terraform is designed to provision the server instances themselves, leaving the job of configuring those servers to other tools.
Configuration management in a simple term is the process where we ensure that all the servers and applications meets the desired state. It can be achieved through a set of processes and tools. By using CM tools we make sure that a system performs on expected lines.
To make IT deployments faster, scalable, incremental, repeatable, predictable, and maintainable one uses CM tools such as Ansible and Puppet.
Please note that we should not get confused between these two terms (automate and orchestrate) because both shares some benefits, at the same time these are inter-dependent and works together to achieve common goals and works in a combination thereof.
All the DevOps tools which we use in our day to day life uses two approaches for writing manifests in order to achieve the desired outcomes - Procedural and Declarative. Let's understand what are these.
Procedural vs. Declarative Language
In Procedural approach you define the whole process or we can say the exact steps in the code to achieve the expected results whereas with Declarative approach you just declare what exactly is needed, not the process by which the result is achieved.
Ansible uses procedural style where you write the code that specifies, step-by-step tasks in order to achieve some desired end state at the same time Puppet uses both approaches.
Whereas orchestration tools like Terraform and CloudFormation by AWS uses declarative methods where you write code that specifies your desired end state. For example if you needed 10 EC2 instances, 1 load balancer etc. you use the declarative approach and get exactly the same number of resources once the code has been executed.
A comparison among Ansible, Puppet and Terraform
Below table lists out the differences and similarities between Ansible, Puppet and Terraform based on different factors:
Characteristic | Ansible | Puppet | Terraform |
PAID/Open Source | Open Source/PAID | Open Source/PAID | Open Source/PAID |
Tool Type | Configuration Management | Configuration Management | Orchestration/provisioning |
Agent Installation | No agents required to communicate with clients | Agent needs to be installed | Terraform also does not require any extra agent to install |
Ease of Setup and Use | Ansible is simpler to install and use | Its initial setup is difficult | Terraform too is simpler to install and use |
Architecture | No concept of Master server, communicates over SSH protocol | Master-Slave Architecture | Terraform is also master less. It communicates with the different providers using API |
Push vs Pull | Follows a “push” workflow | Follows a “pull” workflow | Follows a “push” workflow |
GUI support | Ansible free version UI is less developed , enterprise version offers a UI but that too has syncing issues | Very interactive GUI | No official GUI. Only third party GUIs are available. |
Process definition approach | Procedural | Procedural/Declarative | Declarative |
Process Ordering | Top-to-Bottom ordering of resources defined in playbook | Random ordering of resources defined in cookbook | Random ordering of resources defined in Terraform script |
Cloud support | works on all clouds | works on all clouds | works on all clouds |
Syntax | YAML | Ruby, Puppet DSL | HCL (Terraform Language) |
Template Language | Jinja2 | Ruby’s ERB | HCL (Terraform Language) |
Dependencies | SSH and Python | Ruby and dependent packages | Depends on providers to manage different platforms |
Idempotency | Supports | Supports | Supports |
Community Support | Large (lacks in Windows support) | Large (most mature Windows support) | Large |
Maturity Level | Medium | Medium | Medium |
Pricing | Basic version is free and open source, Enterprise support costs ~ $10,000 per year for up to 100 nodes | Basic version is free and open source. It costs ~ $100 per node for the standard editions and $199 per node for the premium edition | Basic version is free and open source. Pricing can be found here. |
Which one I should go with?
Honestly speaking it totally depends on one's own requirements.
If we talk about the real world IT organizations then you will find almost all the tools being utilized there as they never rely on one specific tool instead use combination of different tools to achieve the desired results. That brings more flexibility and stability.
I personally use Terraform for orchestration/provisioning on public cloud platforms (as this is what it was created for) and Ansible for all kind of configuration management.
My mantra is "Use what is best, suites your requirements and originally created for the tasks you want to perform."
There are people who prefer to use one tool for everything and that's perfectly fine as long as it servers their purpose!
Conclusion
I hope you have a basic idea about all these three tools we have discussed above and be clear that nothing is perfect as all of them have their own benefits and limitations. Chose what's best suites you.
That's all for now. Hope you like the article. Stay Tuned and don't forget to subscribe for more.
Thank you. Happy learning!