123DevOps··6 min read

Toil Automation: how to identify, measure, and eliminate your team's repetitive work

What toil is (and what it isn't), how to measure how much time it eats, how to prioritize what to automate, and a roadmap from runbook to self-healing.

SRE

Restarting the same service every Monday. Freeing up disk space when the alert goes off. Creating a database user because another team asked. Renewing a certificate by hand every 90 days. None of these tasks is hard — and that’s exactly the problem. They’re toil: work that drains the team without leaving anything of value behind.

What toil is (according to Google’s SRE book)

Not all operational work is toil. To fall into that category, a task is usually:

  • Manual — someone has to run the steps;
  • Repetitive — it’s been done before and will be done again;
  • Automatable — a machine could do it as well or better;
  • Tactical — it reacts to something instead of following a strategy;
  • Devoid of enduring value — once it’s done, the service is no different;
  • Scales with growth — doubling the number of customers doubles the task.

What isn’t toil: planning meetings, writing a postmortem, designing an architecture, investigating a new incident. It might even be tedious, but it produces learning or lasting improvement.

The classic recommendation is to keep toil below 50% of an SRE team’s time. Above that, the team turns into a manual operations center and stops improving the system — and toil grows along with the product until there’s no time left for anything else.

Step 1: measure before you automate

The team’s gut feeling about “what takes up the most time” is usually wrong. For two to four weeks, log operational work:

  • Tag tickets and alerts with a toil label and a category (e.g., disk, access, manual-deploy).
  • Ask each person to jot down, at the end of the day, their repetitive tasks and roughly how long they took.
  • Export the on-call history: which alerts show up every week and what action was taken.

At the end, you’ll have a table like this:

Task Frequency/month Time per occurrence Hours/month Risk of human error
Restart stuck queue worker 20 15 min 5 h Medium
Free up disk space on build nodes 12 20 min 4 h Low
Grant read access to the database 15 10 min 2.5 h High
Renew internal TLS certificates 2 1 h 2 h High

Step 2: prioritize by return (and by risk)

A simple calculation helps: if a task takes 5 hours a month and automating it takes 2 days (16 hours), it pays for itself in just over 3 months — and keeps paying after that.

But don’t look at time alone. Also prioritize by:

  • Risk of human error: manual tasks in production, with long commands copied from a wiki, cause incidents.
  • Interruption: 10 minutes in the middle of focused work costs much more than 10 minutes.
  • Dependence on individuals: if only one person knows how to do it, the task is a continuity risk.

And before automating, ask: does this task need to exist at all? The worker that gets stuck every Monday doesn’t need a restart script — it needs a root-cause fix. Automating a bad process just makes the bad process run faster.

Step 3: climb the automation ladder

You don’t need to go from manual to autonomous in one jump. Every rung already reduces toil:

  1. Documented: a clear runbook with tested commands.
  2. Scripted: the runbook becomes a script versioned in Git and reviewed like code.
  3. Self-service: whoever needs the task runs it themselves, safely and with an audit trail.
  4. Automatic: an event (alert, schedule, webhook) triggers the script with no human involved.
  5. Autonomous: the system adjusts itself and the problem stops existing (e.g., autoscaling, cert-manager).

Example: self-service restarts with GitHub Actions

Instead of asking the platform team to restart a deployment, the product team triggers a workflow itself — with a closed list of options, approval through a protected environment, and a record of who ran it:

name: restart-deployment
on:
  workflow_dispatch:
    inputs:
      namespace:
        description: Namespace
        required: true
        type: choice
        options: [checkout, payments, catalog]
      deployment:
        description: Deployment name
        required: true
        type: string

jobs:
  restart:
    runs-on: ubuntu-latest
    environment: production # requires approval configured in the repository
    steps:
      - uses: azure/setup-kubectl@v4
      - name: Rollout restart
        env:
          KUBECONFIG_DATA: ${{ secrets.KUBECONFIG }}
          NS: ${{ inputs.namespace }}
          DEPLOY: ${{ inputs.deployment }}
        run: |
          set -euo pipefail
          [[ "$DEPLOY" =~ ^[a-z0-9-]+$ ]] || { echo "invalid name"; exit 1; }
          echo "$KUBECONFIG_DATA" > kubeconfig
          export KUBECONFIG="$PWD/kubeconfig"
          kubectl -n "$NS" rollout restart "deployment/$DEPLOY"
          kubectl -n "$NS" rollout status "deployment/$DEPLOY" --timeout=5m

Note two security details: the inputs are passed through environment variables (rather than interpolated directly into run, which would open the door to command injection), and the deployment name is validated before it’s used.

Example: from alert to self-healing

For known problems that are safe to fix, the alert can trigger the fix directly. A common pattern:

  1. Alertmanager sends the DiskAlmostFull alert to a webhook.
  2. An automation service (Rundeck, StackStorm, AWS Systems Manager Automation, or a serverless function) cleans up caches and old artifacts.
  3. The automation checks whether the alert has resolved. If it hasn’t, it escalates to a human with context on what was already tried.
  4. Every run emits an event for the weekly review — if self-healing runs 30 times a month, there’s still a root-cause problem.

And some tasks simply disappear with the right tool: cert-manager renews certificates, Karpenter or Cluster Autoscaler handles node capacity, and lifecycle policies clean up old artifacts in registries and buckets.

Automation pitfalls

  • Automation without observability. If the script fails silently, you’ve traded visible toil for an invisible incident.
  • Automation without an owner. Orphaned scripts break when the infrastructure changes. Treat automation like a product: repository, review, tests, and an owner.
  • Overly powerful automation. A script that can delete any resource will, one day, delete the wrong one. Limit permissions, and use dry-run and confirmations for destructive actions.
  • Hiding the symptom. Self-healing that restarts a service 50 times a day masks a problem that will blow up some other way.

How to show results

Repeat the Step 1 measurement every quarter and track:

  • Hours of toil per week (the trend, not the absolute number);
  • Percentage of team time spent on toil versus engineering projects;
  • Alerts per on-call shift and how many required human action;
  • Incidents caused by manual execution.

These numbers are your best argument for getting time for the next automation cycle.

If you’re doing something for the third time, automate it. But first, ask whether you needed to do it the first time.

Get updates on new posts and stay in the loop!