Ansible vs Terraform | Which one to start with?
When it comes to Infrastructure as Code Ansible and Terraform are the main players in the market. Starting with Infrastructure as Code most often means that we make a decision for either of both tools. This article covers the one thing that is necessary to make a good decision.
Selecting the right tool for doing Infrastructure as Code is an important decision. In the last decade I had to make that decision numerous times and over the years things have changed drastically. IT Automation was only popular with large organizations not too far in the past. Nowadays it is so widely adopted that we even automate the setup of individual machines at home or in the cloud. That only takes a couple of minutes while a decade ago it would have taken several days.
While there are a lot of IaC tools out there and all of them have their use cases starting with Infrastrucutre as Code often boils down to the decision between Ansible and Terraform. The problem with that decision seems to be that both tools are completely different and people often have a hard time understanding their basic principles. There are a lot of pages on the internet that compare their features but that can make things even more confusing.
When we have to decide whether we want to go with Puppet, Chef or SaltStack and we do not have experience with IaC at all it is a very tough decision. Skimming through the feature list and deciding which one is the most important for us is really hard. Why? Becasue we know that we have to stick with our decision and if we decide wrong we may waste a lot of time. It is a lot of effort setting up servers and agents until we get to our first small results. Then if we finally realize we should have done something completely different that can make our whole Automation project fail. A good example of a waterfall project.
At first glance it may look we have the same problem with choosing Ansible or Terraform. But there is a major difference. Both Ansible and Terraform are tools that are born out of an agile mindset. There is no need to make a decision based on something we read on the internet. We can simply try them out and get a basic understanding of how they work.
It may cost us days or even weeks to try out Puppet, Chef and SaltStack. Only then we will be able to make a profound decision. Typically we do not have that time so we have to make that decision based on information we find on the Internet. Once we have decided we have to go with that decision.
On the other hand if we want to try out Ansible and Terraform we can get first results within an hour. We get a basic understanding what we decide for. We get first experience with it. Then we can make not only an informed decision but one that is based on experience. And the beauty of it is that we can not decide wrong. If we decided to go with Ansible and later on we notice that for some tasks Terraform would have been a better choice we can simply use Terraform in addition to Ansible. If we decide to start with Ansible it does not mean we can not use Terraform as well.
The shift from waterfall to agile is not only a shift in mindset. It is a shift from making decisions based on knowledge to making decisions based on experience.
If you have to decide for either Ansible or Terraform do not search for the answer on the internet. Be agile and try it out.