Self-published Ansible book – 87k copies, 300k revenue, 41 revisions
jeffgeerling.com
jeffgeerling.com
I really, really, HATE Ansible.
There is a special place in hell where all the worst of humanity go. It's a room where you must build either Ansible or Jenkins infrastructure, for eternity.
Since Jeff is a professional, I am assuming his book does not detail the myriad ways in which Ansible is just fucking horrifically designed and a nightmare to use. Where the docs are usually missing or incomprehensible. Where important features seem to just not exist. Where barely anything works - but when it does, it works in a totally asinine way, that you will spend hours figuring out. Even if you've done it before. Or the nightmare that is trying to debug it, or use it with modern cloud infra and best practices.
Sometimes - rarely - Ansible is an OK solution. It's more lightweight than its competition in the configuration management space, and it can be portable, if you add all the portability yourself. Well-maintained Galaxy stuff is quite useful and can save you weeks of time and years of therapy.
But for the most part, it and its Configuration Management brethren are better left for systems where someone is manually monkeying with them and breaking them, and you need something automated that also has some dependency-tracking to fix complex things for you.
The Cloud is still, sadly, mostly not immutable. So we still need shitty "orchestration" (Configuration Management) tools to maintain it. But I really hope they go away. I have never seen a Configuration Management tool that I have liked, because their very concept is automated duct tape.
(my bona fides: 20 years operating large-scale systems, including a reimplementation of DynamoDB, which was powered by OpenStack and AWS infra scaled dynamically by Ansible playbooks. I. Still. Have. Scars.)
1. You build custom VM images that have everything you need baked in. You don't upgrade these VMs, instead you build new ones and delete the old ones.
2. You use cluster management tools like Kubernetes or Nomad and run your software as containers. You upgrade by running a new version of the container. (If you choose to manage your own nodes in the cluster, you manage them as VMs using method 1.)
3. You don't run your software on servers you manage. You use so-called "serverless" services where your software doesn't have to think too hard about the OS it's running on.
2. A container: here is a bit simpler since you may use docer-compose...
For 2. You don't even need compose. Just build a container image from a Dockerfile.
In a typical cloud deployment, you can have many servers and you need to quickly configure them and deploy software. Doing it manually through SSH may not scale and can be error prone. So, automation helps and as a bonus you get to leverage existing expertise.
While many of the ready made scripts do get the work done for standard tasks, I've seen lot of custom scripts depending on the environment and business needs. So, its a mix.
For VMs you build image with everything baked in (think packer) or use cloud-init and do that on the fly on top base Linux image. For other apps serverless or sort of k8s solution.
Then Terraform or Pulumi to configure and push above to the cloud and maintain state.
My "deploy script" is simply a Github CI/CD action that builds the new docker images, pushes them to the GCR, and then logs into my VPS via SSH, pulls the images in, and restarts services. Works pretty good for small scale deployments and I get all the configuration and pinned versioning stuff into the images while not needing to go fullscale kubernetes which seems imho overkill for a single vps setup.
In the 'outside' real VPS the only thing I have, if those service need HTTP(s) ingress, is set up a simple ssl enabled webserver to reverse proxy shit back to the containers, and for that I use Caddy which auto handles generating ssl certs for your internet facing domains etc.
But if you don’t nuke & pave your infrastructure, Ansible is much better than other desired state configuration tools (Puppet was infamous for locking us out of machines, Salt was full of quirks, PowerShell DSC is… well… just not something I’ve ever liked to use in any way, etc.)
Anything requiring any sort of finesse especially on timing is yeah…rough as you say
I've thought about building something like this in Rust. Maybe something that compiles a statically linked binary which gets uploaded over the wire, and that is the thing that gets run in the final system to apply your new config state.
Source: been using Ansible for 8 years and SysEng'ing for 15.
Many technical books are out of date within a few months of publishing and get no revisions
A 5 minute, yearly "wellness visit" costs my insurance company $200 (or so they say) and that's not even including any bloodwork.
And if you enable "wide distribution" you get much less for those.
Thanks, Jeff, for being interminably helpful.