Capstone Project โ Build a Config Deployment Pipeline
Capstone Project: Build a Config Deployment Pipeline¶
"Everything You've Learned, in One Codebase That Actually Ships"¶
Every tutorial up to this point taught one thing well. You can model intent in YAML, validate it with Pydantic, render it with Jinja2, deploy with Nornir, verify with PyATS, log in JSON and roll back when something breaks.
What you probably can't do yet is put them in a line and have them hold.
That's what this capstone is for. Over seven chapters you build one project, in one repository, that takes a YAML description of what a site should look like and turns it into a proven, audited change on real devices. Each chapter adds one layer and ends with something you can run.
๐งญ What You're Building¶
netpipe โ a small, honest deployment pipeline. Not a framework, not a product; roughly the size of tool a two-person automation team would actually write and maintain.
intent (YAML)
โ chapter 2 โ validate, or refuse to continue
typed models
โ chapter 3 โ render, diff, get a human to look
candidate config
โ chapter 4 โ credentials, reachability, pre-flight gates
cleared to deploy
โ chapter 5 โ push with Nornir, retry and audit via decorators
applied change
โ chapter 6 โ prove it with PyATS, independently
verified state
โ chapter 7 โ roll back on failure, write the evidence
audit record
Read that column of arrows again: each one is a gate. Nothing moves to the next stage unless the previous stage succeeded. That's the actual lesson of the capstone, and it's a structural one โ no individual technique on this site teaches it, because it only exists in the joins.
๐ The Chapters¶
Chapter 1 โ Intent and Repository Layout¶
Set up the project skeleton and write the YAML that describes a site. Decide what belongs in data and what belongs in code โ the decision every subsequent chapter depends on.
You'll run: a loader that prints your site back to you. Builds on: YAML Data Modelling
Chapter 2 โ Validating Intent¶
Turn the YAML into typed Pydantic models with your naming standards, VLAN rules and design constraints encoded. Make bad intent impossible to deploy.
You'll run: netpipe validate โ passing on good intent, refusing with a readable report on bad.
Builds on: Pydantic Data Validation, JSON Data Handling
Chapter 3 โ Rendering Configuration¶
Generate candidate configs with Jinja2, diff them against what's currently on the device, and produce a change plan a human can review before anything is pushed.
You'll run: netpipe plan โ a unified diff per device, and a summary of what would change.
Builds on: Jinja2 Configuration Templates
Chapter 4 โ Credentials and Pre-Flight¶
Get secrets out of the codebase, then add the gates that run before any write: reachability, identity, config register, free flash, and no competing change in progress.
You'll run: netpipe preflight โ a pass/fail table per device.
Builds on: Credential Management, Health Checks and Pre-Flight Validation
Chapter 5 โ Deploying with Nornir¶
Push the change in parallel, with retry, rate limiting and audit logging supplied by decorators. Batch the rollout so a bad template can't take a whole site with it.
You'll run: netpipe deploy โ in batches, with a dry-run mode you'll use far more often.
Builds on: Nornir Fundamentals, Decorators in Network Automation
Chapter 6 โ Proving the Change with PyATS¶
Verify independently. Not by re-reading your own configuration lines, but by learning operational state with Genie and comparing it against a snapshot taken before the change.
You'll run: netpipe verify โ a state diff, and a clear verdict.
Builds on: PyATS Fundamentals, PyATS Network Validation
Chapter 7 โ Rollback and the Audit Record¶
Wire failure to automatic rollback, and emit a structured JSON record of what was intended, what was done, what was proven and who approved it. Finish the pipeline.
You'll run: netpipe run โ the whole thing, end to end, with an audit artefact at the finish.
Builds on: Error Recovery and Rollback, Structured Logging, State Management and Idempotency
๐ Prerequisites¶
This capstone assumes the intermediate track, particularly the data modelling quartet. You don't need to have finished every reliability tutorial โ each chapter links back to the one it draws on, and you can read that page when you get there.
Required Knowledge¶
- โ The data modelling quartet: YAML, JSON, Pydantic, Jinja2
- โ Nornir Fundamentals โ inventories and tasks
- โ PyATS Fundamentals โ testbeds and Genie parsing
- โ
Comfortable with Python packages, virtual environments and
argparse
Required Software¶
python -m venv netpipe_venv
source netpipe_venv/bin/activate
# Windows PowerShell: .\netpipe_venv\Scripts\Activate.ps1
pip install "pydantic>=2.0" pydantic-settings pyyaml jinja2 \
nornir nornir-netmiko nornir-utils netmiko \
pyats[library] rich
Required Access¶
Two or more Cisco IOS-XE devices you are allowed to configure. Use a lab. CML, EVE-NG, GNS3 or a pair of spare switches on a bench โ this project writes configuration, and chapters 5 to 7 are considerably more instructive when you can safely break something.
Every chapter also has a dry-run path that works with no devices at all, so you can read and build along without a lab and come back to the execution chapters later.
๐๏ธ Where You'll End Up¶
netpipe/
โโโ intent/
โ โโโ man1.yaml # what the site should be
โโโ netpipe/
โ โโโ models.py # ch2 โ the data contract
โ โโโ settings.py # ch4 โ credentials and config
โ โโโ render.py # ch3 โ intent to candidate config
โ โโโ diff.py # ch3 โ candidate vs running
โ โโโ preflight.py # ch4 โ the gates
โ โโโ deploy.py # ch5 โ the write phase
โ โโโ verify.py # ch6 โ independent proof
โ โโโ rollback.py # ch7 โ undo
โ โโโ audit.py # ch7 โ the evidence
โ โโโ cli.py # the operator's front door
โโโ templates/
โ โโโ access_switch.j2
โโโ inventory/ # Nornir
โโโ tests/
โโโ artefacts/ # snapshots, diffs, audit records
Around 800 lines of Python by the end. Small enough to read in a sitting, structured enough to extend.
๐ฏ How to Work Through This¶
- Build it, don't read it. Type the code. The chapters are written to be followed with a terminal open.
- Go in order. Chapter 5 deploys what chapter 3 rendered from what chapter 2 validated. Skipping leaves you with missing imports.
- Run the dry-run paths first, every time, even once you have a lab. That habit is half the point.
- Substitute your own network. The examples use a two-switch access layer because it's small. Your VLANs, your naming standard and your templates will be different, and the pipeline shape won't change.
Already Have Scripts in Production?
You don't have to build netpipe to get value here. Read chapter 2 and chapter 6 and compare them against what your current scripts do at those two points โ validation before, proof after. Those are the two stages most working automation is missing, and they're the two that decide whether a change is safe or merely finished.
Between the Lines
Odysseus wanted to hear the Sirens and knew he could not be trusted to. So he had himself lashed to the mast, stopped his crew’s ears with wax, and ordered in advance that no later order of his was to be obeyed. The plan works precisely because it does not rely on his judgement at the moment it matters.
A pipeline is mostly refusals: seven stages, and six exist to stop something — bad data, an unreviewed diff, an unreachable device, a failed push, an unproven outcome, a change nobody can account for afterwards. The stage doing the actual work is one line in the middle. That ratio feels wrong when you first build it, as though you have written a great deal of machinery to avoid doing very little. It stops feeling wrong the first night the refusals are what stand between you and an outage you would otherwise be explaining in the morning.
๐ Related Reading¶
- Production-Grade Network Automation Principles โ The reasoning behind each gate in this pipeline
- Separating Read and Write Phases โ Why plan and deploy are different commands
- Building Audit-Ready Automation โ What chapter 7 is really producing
- Deep Dive: Cisco Config Generator โ A production tool built on the same pattern, at full scale
- Expert Tutorials โ Where to go once the pipeline works
Remember: The individual techniques are the easy part. The engineering is in the joins โ what each stage refuses to pass on.