The document nobody finds in time
Every operation has procedures: what to do when a disk fills up, how to renew a certificate, how to restart a service that has hung. They usually live in documents. At best, up to date. Usually, written years ago by somebody who is no longer around.
During a night-time alert, whoever is on call has to find the document, understand it and run it by hand without making a mistake. It is exactly the moment when all of that is done worst.
From document to code
A procedure as code does the same as the document, but without depending on who runs it:
- It triggers itself, from the alert or from a schedule.
- It diagnoses before acting: it checks that the situation is the one the procedure knows how to resolve.
- It applies the known fix, repeatably (if it is already applied, it does nothing).
- It verifies the result: was it actually resolved?
- It escalates to a person if the verification fails or if the case is not the expected one, handing over what it has already diagnosed.
And every run is recorded: when it triggered, what it found, what it did and with what result.
Where to start
The best candidates are tasks that are frequent, well understood and low risk: clearing temporary files, renewing certificates, rotating logs, restarting a service with a known fault, expanding a disk within a limit. Each saves little on its own; together they free up many hours and, above all, many nights.
What does not change
An automated procedure does not replace analysis. If the same problem triggers every week, the answer is not to automate the patch better, but to resolve the cause (the idea behind every failure leaves a rule).
And not every procedure should be automated. Knowing what to leave out matters as much as everything above.
How we apply it: Automation and IaC.