Lion Cipher Lab

Harden a Linux server with an Ansible role (an idempotent CIS-style baseline) — automation, Part 2

Why it matters

Clicking through the same twenty hardening steps on every new server is slow, error-prone, and impossible to audit. A hardening role turns "secure this box" into one repeatable, reviewable file you can run on one server or a thousand, prove is applied, and re-run any time to catch drift. This is config-as-code — the same skill that underpins real infrastructure, compliance evidence, and blue-team baselines.

What you'll learn

Steps in this lab

  1. The words you need, defined once
  2. Why a role beats a bash script (the judgment)
  3. Pick and reach a target box
  4. Scaffold the role
  5. Write the SSH-hardening tasks
  6. Write a playbook that applies the role, and run it
  7. Prove idempotence — run it again
  8. Lint the role with ansible-lint
  9. When NOT to hand-roll: don't reinvent the CIS baseline
  10. What you built — and where it goes

Open the full interactive lab →