Template an OSPF fabric from a vars file
Stop hand-writing configs. Write one Jinja2 template that generates every router's OSPF config from a vars file, and prove the rendered fabric actually converges.
Scenario
Three routers form an OSPF fabric: r1 - r2 - r3. Hand-writing each config doesn't scale. Your job
is to write one Jinja2 template that renders every router's config from a shared vars file. The
grader renders your template once per router (passing that router's data as router) and checks the
resulting network actually converges.
The vars (read-only)
Each router is rendered with a router variable shaped like this:
routers:
- name: r1
loopback: 1.1.1.1
interfaces:
- { name: eth1, ip: 10.0.12.1, len: 30 }
networks: [ "1.1.1.1/32", "10.0.12.0/30" ]
- name: r2
loopback: 2.2.2.2
interfaces:
- { name: eth1, ip: 10.0.12.2, len: 30 }
- { name: eth2, ip: 10.0.23.1, len: 30 }
networks: [ "2.2.2.2/32", "10.0.12.0/30", "10.0.23.0/30" ]
- name: r3
loopback: 3.3.3.3
interfaces:
- { name: eth1, ip: 10.0.23.2, len: 30 }
networks: [ "3.3.3.3/32", "10.0.23.0/30" ]
Your job
Edit template.j2 so that, for each router, it renders:
- the loopback and every interface address, and
- a
router ospfblock advertising all of that router'snetworksinto area 0.
Supported template syntax
{{ expr }} interpolation (dotted paths like {{ router.name }}), {% for x in list %}…{% endfor %},
and {% if cond %}…{% endif %}.
What "done" looks like
A real template (not a pasted static config) that renders configs which bring up every OSPF adjacency,
so r1 can reach 2.2.2.2 and 3.3.3.3.
Teaches: config templating, the core skill behind Ansible, Nornir, and every real network-automation pipeline.
What gets checked
Your solution is verified against each of these:
- The solution is a real template (uses {{ }} / {% %}), not a hardcoded config
- The rendered configs bring up every OSPF adjacency on the fabric
- From r1, every router loopback (2.2.2.2, 3.3.3.3) is reachable via OSPF
Solve it in your browser
No setup, no install. Write your solution in the editor and hit Check. The in-house engine renders and grades it instantly, then issues your proof the moment every check passes.
Solve in browser →Prefer your own lab?
- Build the fix locally. New to the tooling? See setting up your lab.
- Push your topology file, device configs, and any playbooks to a public repo (GitHub or GitLab).
- Submit the repo link. We review it by hand, confirm it works, and issue your proof page.