Anywhere you're dealing with bare metal you can't really use Terraform. Terraform also doesn't get you much within a host, so to speak. One example of that idea, if you use Packer to bake AMIs, with Ansible as the provisioner, you get the simplicity of Packer with the integrated secrets management and templating of Ansible.
Also, not everything is an immutable infrastructure change. Sometimes you just need to do things repeatably against a set of hosts, and Ansible is good at that.
If you're willing to write code, I found it a good fit for provisioning servers over ILO/Redfish.
The biggest issue for me is that Terraform is still pretty bad at looping and handling dependencies sometimes. They have ways to try to work around it, but sometimes it's much easier to say "Do X, then Y, then Z".
With Ansible, I can explicitly set the step order, and even write a quick module if I need to interface with an external API.
To me it is a weird regression back to “imaging” machines constructed haphazardly with shell scripts and manual action, it’s just faster.
It makes it difficult to work in the current environment.
For smaller systems one could use Ansible to create the infrastructure too, but I don't think it scales very well.
To do a rolling deployment though, it does become awkward, as you essentially have to model both the old version and the new version in your code, and then run the commands several times to scale up the new cluster and scale down the old one in stages. It's basically a modelling of a blue/green deploy.
> Immutable infrastructure killed Ansible.
I haven't used Ansible in several years, but when I was using it I was using it to build immutable AMIs. So obviously this comment is off base. However, I have been using terraform for years now.
Can anyone describe why one might use Ansible over Terraform? I understand the differences, but I don't think I know people using Ansible as their primary deployment/provisioning solution recently.