What is IT automation?

Automation means writing down an operations task once, in code, so a computer performs it the same way every time instead of a person repeating it by hand.

Which tasks should be automated first?

Frequent, error-prone and boring ones. A useful rule: if a task happens weekly or more, takes more than a few minutes, or has caused an incident when done wrong, automate it. Typical first candidates on servers are applying updates, renewing certificates, rotating logs, taking and checking backups, creating user accounts and deploying releases. Rare, judgement-heavy work such as investigating an unusual outage stays manual, though gathering its diagnostics can still be scripted.

Should I write scripts or use a declarative tool?

Both have their place. A script lists steps to perform; a declarative tool describes the end state and works out the steps. Scripts are quick to write and perfect for one-off jobs and glue. Declarative tools such as Ansible, Salt or Puppet are idempotent, so running them repeatedly is safe, and they report what they changed. For anything that configures servers over time, declarative wins.

ApproachStrengthWeaknessGood for
Shell scriptFast to write, runs anywhereEasy to make unsafe on rerunsGlue, one-off tasks, diagnostics
Configuration managementIdempotent, shows driftLearning curveServer configuration, packages, users
Infrastructure as codePlans before applyingNeeds an API to talk toDNS, cloud resources, monitoring setup
PipelinesTriggered by code changes, loggedNeeds CI infrastructureBuilds, tests, deployments

How do I make a shell script safe to run twice?

Check before changing, fail loudly and avoid partial states. Start with strict mode, test whether each change is already in place, write to a temporary file and move it into place in one step, and log what happened. A small example that adds a sysctl setting only once and reloads it:

#!/usr/bin/env bash
set -euo pipefail
conf=/etc/sysctl.d/70-net.conf
want='net.core.somaxconn = 8192'
if ! grep -qxF "$want" "$conf" 2>/dev/null; then
  tmp=$(mktemp); { cat "$conf" 2>/dev/null || true; echo "$want"; } > "$tmp"
  install -m 0644 "$tmp" "$conf"; rm -f "$tmp"
  sysctl --load="$conf" >/dev/null; logger -t netconf "applied: $want"
fi

How are automated jobs scheduled?

With systemd timers or cron for time-based jobs, and with events for everything else. Systemd timers log to the journal, can catch up on runs missed while the server was off, and add random delays to avoid many servers acting at once. Event triggers come from pipelines (a merge to main deploys), monitoring (a full disk triggers cleanup) or webhooks. Our CI/CD article covers pipeline-driven automation.

# /etc/systemd/system/db-dump.timer
[Timer]
OnCalendar=*-*-* 02:40
RandomizedDelaySec=15m
Persistent=true
[Install]
WantedBy=timers.target

What safety rails should automation have?

Dry runs, small blast radius, and easy rollback. Run changes in check mode first (ansible-playbook --check --diff), apply to one server before all, and keep every automation in version control with review. Limit what automation credentials can do, so a bug cannot delete everything. Alert when a scheduled job fails or stops running, since silent failures of backup or renewal jobs are among the most damaging. Our Incident management article covers responding when automation does go wrong.

What can be automated on rented servers?

Everything from the operating system up, and much of the setup. After delivery, one playbook can harden SSH, configure the firewall, install packages, create users, set up monitoring agents and deploy the application. Reinstalling from the console then becomes a quick reset rather than a day of work, which is what makes moving to a new model or location painless. Our Bare metal automation article covers this specifically for physical servers, and Infrastructure as code the wider approach.

Where should automation run from?

From a control machine separate from production, with its own access controls. A small server such as ESSENTIAL-1 at $38.40 a month can host the configuration repository, run playbooks on schedule, hold the secrets vault and run the CI runner for automation code. Keep it backed up; it holds the knowledge of how to rebuild everything else.

How do I know automation is paying off?

Track time spent on repeated tasks, incidents caused by manual steps, and how long it takes to rebuild a server or set up a new one. Teams that automate well usually rebuild a server in minutes rather than hours and see fewer configuration differences between machines. Our DevOps article places automation within the wider way of working.

Related pages

Bare metal automation

Treat rented physical machines like code: unattended installs, cloud-init style first boot, configuration management, image pipelines and rebuild drills.

Read more

Infrastructure as code

Describing servers, networks and services in versioned files: declarative against imperative tools, state, review workflows, drift and where rented machines fit.

Read more

DevOps

The working culture that joins building and running software: shared ownership, automation, small frequent releases, measurement and the practices that support them.

Read more

Server provisioning

Every step between ordering hardware and running a workload: allocation, operating system install, network setup, configuration management and validation checks.

Read more

Questions and answers

What should be automated first on a server?

Frequent and error-prone tasks: updates, certificate renewal, backups and their checks, log rotation, user management and deployments.

What does idempotent mean in automation?

Running the same automation repeatedly produces the same result, changing nothing when the system is already in the desired state.

Are systemd timers better than cron?

They log to the journal, can catch up on missed runs and add random delays. Cron remains fine for simple jobs.

How do I test automation safely?

Use dry runs such as Ansible check mode, apply changes to one server first and keep every automation under version control with review.

Can I automate the setup of a new dedicated server?

Yes. After delivery, run a configuration playbook against the new address to install packages, harden access and deploy applications.