3 ms·
Someone made the comment below, which can't be responded to, but I did have a question about it. The comment: > Immutable infrastructure killed Ansible. I hav
by ganstyles 6y ago
Someone made the comment below, which can't be responded to, but I did have a question about it. The comment:
> 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.
- tyree731 6y ago> Can anyone describe why one might use Ansible over Terraform? 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.
- escardin 6y agoThe tooling for Terraform with bare metal is poor, but it is out there. There are plugins for MAAS, Cobbler, Some giant HPE thing I never wanted to touch. If you're willing to write code, I found it a good fit for provisioning servers over ILO/Redfish.
- tyree731 6y agoGood to know, I'll check it out at some point.
- manishsharan 6y agoI began using Ansible much before I learnt of Terraform . However , my Ansible scripts have been working flawlessly and the Python plugins and YAML makes it easy for me to figure out what it was that I wrote so many years ago.( Note to self -- must learn Terraform, Packer).
- krmboya 6y agoI'm not too experienced with Terraform, can one use it to, for example, do a rolling deployment with something like haproxy as the load balancer?
- tyree731 6y agoDefinitely not, you'd need to use something like Spinnaker to accomplish that.
- krmboya 6y agoBut one can do this with Ansible in a non-containerized environment
- escardin 6y agoConceptually this is exactly what Terraform is made for. It will deploy things with the parallelism rate you specify, and is designed to neatly scale your infra up and down. 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.
- chousuke 6y agoI view Ansible and Terraform as complementary tools; I can imagine performing rolling upgrades by using Ansible to shoot down a node and then have Terraform rebuild it; and Terraform could use Ansible to configure the nodes, if you're not using images. For smaller systems one could use Ansible to create the infrastructure too, but I don't think it scales very well.
- colechristensen 6y agoThe kids who grew up with containers are resistant to config management tools. 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.
- slipheen 6y agoI use both in conjunction. There are Ansible modules to run terraform, for example. 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.
- deleted 6y ago[deleted]