online posts 16
lessons

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.

Ansible 101 for networking

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. 1 8 min · lab chapter 1, 3 tasks 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. 2 9 min · lab chapter 2, 2 tasks 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. 3 7 min · lab chapter 3, 2 tasks 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. 4 7 min · lab chapter 4, 2 tasks 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. 5 7 min · lab chapter 5, 3 tasks 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. 6 6 min · lab chapter 6, 2 tasks 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. 7 6 min · lab chapter 7, 1 task 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. 8 7 min · lab chapter 8, 3 tasks 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 …