Ansible 101 for networking
Ansible from zero for network engineers: inventory, playbooks, variables, loops and templates, handlers, roles, vault, and running it like production. Eight lessons, each with a hands-on lab chapter on real switches running CapeOS.

Most Ansible tutorials are written for servers. This one is for people who run networks: every example is a switch, every lab task runs against a real leaf-spine fabric, and every lesson ends with something you’d actually use on Monday. Each lesson comes with a chapter of the hands-on lab, in your browser with Codespaces, nothing to install.
- 1
Hello, Ansible
Ansible for people who run networks, not servers. What Ansible actually does when the target is a switch, how an inventory works, how to point it at a fabric of switches … - 2
Your first playbook
Plays, tasks and modules, explained with switches. Write a playbook that configures a whole fabric, read the PLAY RECAP like a pro, prove it's idempotent, and use check … - 3
Variables and facts
Stop hard-coding values in playbooks. group_vars and host_vars, where Ansible actually looks for them, the three precedence rules you need (out of twenty-two), and asking … - 4
Loops, conditionals, templates
Configure every port on every switch from a list of data with loop, treat uplinks differently with when, and render a report of the whole fabric with Jinja2 templates. … - 5
Handlers, tags, errors
Save the config only when something actually changed with handlers, run just part of a playbook with tags, and recover when a change fails halfway with block, rescue and … - 6
Roles and collections
Turn a folder of playbooks into roles: tasks, defaults and handlers in a reusable unit, the precedence rule that makes role defaults useful, why role variables need a … - 7
Secrets
Get the switch password out of plain text: ansible-vault, what to encrypt and what not to, the vault_ variable pattern, keeping the vault key off the repo, and where … - 8
Run it like production
The finale: package Ansible, its collections and their dependencies into an execution environment, run playbooks with ansible-navigator, pass ansible-lint's production …