Network automation lab 19 of 27
Troubleshooting lab: Netmiko, Jinja2 and Ansible automation that worked yesterday
A colleague's automation project fails in eight different ways across two routers and the workstation: wrong device types, a mistyped address, SSH disabled, a user without privilege, an undefined template variable, broken YAML, the wrong Ansible connection and a task that is never idempotent. Find each fault from its symptoms, fix it, and prove the whole project runs clean twice.
Run this lab
It needs Lite: its 3 nodes are set to 3 vCPU and 2,048 MB in total. That fits the free demo too.
In your workspace: Shared, then Network Automation - CCNA and CCNP Automation guided labs, then 19 - Troubleshooting lab - Netmiko Jinja2 and Ansible automation that worked yesterday
- Level
- Advanced
- Time
- About 75 minutes
- Nodes need
- 3 vCPU, 2,048 MB
- Smallest plan
- Lite
The scenario
Your colleague Tom built a small automation project for the Leeds routers before going on holiday: collect.py backs up the configurations with Netmiko, render.py renders each router's Loopback0 configuration from a Jinja2 template, and an Ansible playbook pushes NTP and the rendered loopbacks. "It all worked yesterday." Today nothing does. Some faults are in the project and some on the routers. Find and fix every fault, one at a time, and finish with a project that runs clean twice in a row.
| Router | Mgmt address | Intended state |
|---|---|---|
| r1 | 10.10.20.11 | SSH for user netops (privilege 15), NTP 10.10.20.10, Loopback0 10.255.0.1/32 "Router ID r1" |
| r2 | 10.10.20.12 | the same, with Loopback0 10.255.0.2/32 "Router ID r2" |
Project in ~/lab/project: inventory.yaml, collect.py, vars.yaml, templates/loopback.j2, render.py, and ansible/ (ansible.cfg, hosts.yml, group_vars/routers.yml, baseline.yml). Login netops / NetOps-Lab1; both routers' consoles are open to you.
What you’ll practise
- Read Python tracebacks, Netmiko exceptions, Jinja2 errors and Ansible failures to locate a fault
- Separate network, transport, authentication, authorisation and code problems methodically
- Recognise silent failures (wrong data, no exception) and validate outputs
- Fix inventory, connection and YAML errors in an Ansible project
- Diagnose and fix a non-idempotent configuration task
The tasks
- Reproduce and triage
- Get r2 backed up (three faults on one line, and one on the router)
- A backup that "worked" but is wrong
- The template
- The playbook won't even load
- The wrong kind of connection
- A task that's never finished
- Prove it and write it up
The Lab Tasks pane has the scenario, these tasks, the checks to run, hints and the full solution.
Topology and devices
The network as it opens in EVE-NG, drawn from the lab’s own canvas, and the image each node runs.
Every link, as text
- devbox
eth0to Mgmt (network) - r1
Gi0/0to Mgmt (network) - r2
Gi0/0to Mgmt (network)
| Node | Device | Image in Add Node | Set to |
|---|---|---|---|
| devbox | EVE-NG GUI server (Docker) | eve-gui-server:latest | 1 vCPU, 1,024 MB |
| r1 | Cisco IOSv | vios-adventerprisek9-m.spa.159-3.m9 | 1 vCPU, 512 MB |
| r2 | Cisco IOSv | vios-adventerprisek9-m.spa.159-3.m9 | 1 vCPU, 512 MB |
How to open this lab
Sign in to your workspace at
lab.cloudlabbox.com.In File Manager, open Shared, then the folder
Network Automation - CCNA and CCNP Automation guided labs.Open
19 - Troubleshooting lab - Netmiko Jinja2 and Ansible automation that worked yesterdayand start its nodes, then open Lab Tasks for the scenario and the steps.
The lab is read-only. You can start the nodes and configure the devices, but changes to the topology can’t be saved. To change it, rebuild it in your own folder.
More Network automation labs
Related labs in other courses
CloudLabBox is independent of Cisco. The lab follows exam topics and isn’t vendor training material; vendor names identify the exams and the images in the workspace.