Is ansible worth learning to automate setting up servers?
Hello, I have recently been seeing a boom in people using ansible for automating setting up vps's, services, ...
Is it worth it to learn ansible to do also automate the way I setup everything, or is a bash script good enough ( I know some bash scripting but ansible seems like it could be more worth the time to learn )?
You are viewing a single comment
IMHO Ansible isn't much different than a bash script... it has the advantage of being "declarative" (in quotes because it's not actually declarative at all: it just has higher-level abstractions that aggregate common sysadmin CLI operations/patterns in "declarative-sounding" tasks), but it also has the disadvantage of becoming extremely convoluted the moment you need any custom logic whatsoever (yes, you can write a python extension, but you can do the same starting with a bash script too).
Also, you basically can't use ansible unless your target system has python (technically you can, but in practice all the useful stuff needs python), meaning that if you use a distro that doesn't come with python per default (eg. alpine) you'll have to manually install it or write some sort of pythonless prelude to your ansible script that does that for you, and that if your target can't run python (eg. openwrt on your very much resource-constrained wifi APs) ansible is out of the question (technically you can use it, but it's much more complex than not using it).
My two cents about configuration management for the homelab:
BTW, nixos is also not beginner-friendly in the least and all in all badly documented (documentation is extensive but unfriendly and somewhat disorganized)... good luck with that :)
Fun fact: I actually run nixos on my main pc.
You will hate Ansible if you are coming from Nix. I went the other way and Nix is 1000x cleaner.
Being able to actually reverse changes is trivial in Nix, but can be a headache in Ansible. Not to mention the advantages of writing in an actual language and not yaml full of template hacks. I personally don't see much future for tools like Ansible, there is considerable inertia working in its favor right now and it is absolutely true that it is widely used, but the future of configuration management is for sure more aligned with how Nix works.