Ask HN: What is the real difference between Terraform and Ansible?
1–10 of 67 posts
Re: Ask HN: What is the real difference between Terraform and Ansible?
#2For example, you can use Terraform to provision virtual machines, database instances, or Kubernetes clusters on AWS. Terraform does this via the AWS API.
In my opinion, Terraform is better for provisioning because of the way it manages its own state. Terraform remembers what resources it created the last time it ran, and can edit or delete them according to any change in your Terraform code.
I like Ansible, but not for managing cloud resources. Ansible has no memory. For example, if I ran a playbook that installs MySQL, Ansible has no built-in way to undo this change and bring me back to my previous state.
Re: Ask HN: What is the real difference between Terraform and Ansible?
#3Re: Ask HN: What is the real difference between Terraform and Ansible?
#4Re: Ask HN: What is the real difference between Terraform and Ansible?
#5I don’t know Ansible much, but I believe it’s more of a procedure-oriented system, where you declare the steps necessary to reach A, then again to go from A to B. This can be an issue if any item is actually not in the state you expected.
Re: Ask HN: What is the real difference between Terraform and Ansible?
#6terraform manages infrastructure (e.g. creating VM). ansible manages configuration (e.g. installing tools on fresh VM)
Re: Ask HN: What is the real difference between Terraform and Ansible?
#7Re: Ask HN: What is the real difference between Terraform and Ansible?
#8Otherwise both are quite good.
Re: Ask HN: What is the real difference between Terraform and Ansible?
#9Terraform can only provision cloud resources on AWS/GCP/Azure/other. Usually it gets support first for new products they release. Terraform is very static (see issues with sharing the state file) so it's more indicated to configure very static stuff, like networking and subnets.
Re: Ask HN: What is the real difference between Terraform and Ansible?
#10You can use Ansible to provision servers, it works, but if you do that a lot it's better to use Terraform. With Ansible you are a bit at a lower level and you need to manage the state of your system yourself. It's fine for 4 permanent VMs but not for more complicated infrastructures.