<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-i-automated-my-network-with-ansible-tpdinhymv" -->

---
title: How I Automated my Network with Ansible | daily.dev
description: A hands-on walkthrough of automating a personal BGP network (AS201726) with Ansible after adding a third POP and fourth router. Covers the full Ansible setup:...
canonical: https://daily.dev/posts/how-i-automated-my-network-with-ansible-tpdinhymv
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How I Automated my Network with Ansible | daily.dev
og:description: A hands-on walkthrough of automating a personal BGP network (AS201726) with Ansible after adding a third POP and fourth router. Covers the full Ansible setup:...
og:url: https://daily.dev/posts/how-i-automated-my-network-with-ansible-tpdinhymv
og:image: https://api.daily.dev/og/posts/tpDinHYmv.png
og:image:alt: How I Automated my Network with Ansible
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How I Automated my Network with Ansible

**[apalrd's adventures](https://daily.dev/sources/apalrd)** · 9 min read · 0 upvotes · 0 comments

## Summary

A hands-on walkthrough of automating a personal BGP network (AS201726) with Ansible after adding a third POP and fourth router. Covers the full Ansible setup: inventory definition with per-router attributes, software installation playbooks (bird3, Tayga NAT64, Proxmox Backup Client), systemd-networkd configuration for IPv6 tunnel interfaces, and BIRD routing config generation via Jinja2 templates. Netbox is integrated as a source of truth for IP address lookups and prefix lists, with playbooks querying it dynamically to build OSPFv3 IGP and iBGP full-mesh configurations.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.apalrd.net/posts/2026/asn_ansible>

## Questions this post answers

### How do I use Ansible to dynamically pull IPv6 addresses from Netbox for BGP peer configuration?

Use the netbox.netbox.nb_lookup plugin to query virtual-machines from Netbox, then build a map of VM name to primary_ip6 address using set_fact and combine(). You can then fail the playbook early if any expected peer is missing from the map. This approach lets Netbox serve as the source of truth for IP addresses rather than hardcoding them in inventory.

_Engineers building network automation pipelines track Netbox and Ansible integration patterns on daily.dev._

### How do I configure systemd-networkd to create IPv6-in-IPv6 tunnel interfaces between routers?

Create a .netdev file with Kind=ip6tnl and Mode=ip6ip6, setting Local and Remote to each router's primary IPv6 address. Pair it with a .network file matching the interface name and assigning a link-local address. Ansible templates can generate these files per peer dynamically, then trigger a networkctl reload handler to apply changes without a full restart.

_Homelab network builders working with systemd-networkd tunnel configs share setups like this on daily.dev._

### How do I template BIRD3 iBGP full-mesh configuration with Jinja2 in Ansible?

Store each router's router_id and peers list in the Ansible inventory, then use a Jinja2 for loop over the peers variable in the bird-ibgp.conf template. Each iteration generates a protocol bgp block using the peer's router_id for the neighbor address and host name for the protocol identifier. A birdc configure handler reloads BIRD after any template change.

_Developers automating BGP routing configs with BIRD and Ansible find peer implementations on daily.dev._

## Similar posts on daily.dev

- [Deep Dive: Automating NetOps with the cisco.catalystcenter Ansible Collection](https://daily.dev/posts/deep-dive-automating-netops-with-the-cisco-catalystcenter-ansible-collection-2bstaaosj) · Cisco · 0 upvotes · 0 comments
- [Automate Infoblox DDI with Red Hat Ansible Automation Platform](https://daily.dev/posts/automate-infoblox-ddi-with-red-hat-ansible-automation-platform-bs3t8sdoo) · Red Hat Developer · 0 upvotes · 0 comments
- [Seven New Integrations for the Stack You Actually Run](https://daily.dev/posts/seven-new-integrations-for-the-stack-you-actually-run-yu8us5b1z) · NetBox Labs · 0 upvotes · 0 comments
- [I mapped every machine in my home lab with this free tool](https://daily.dev/posts/i-mapped-every-machine-in-my-home-lab-with-this-free-tool-pd1pjeshn) · XDA Developers · 2 upvotes · 0 comments

---

Tags: [#networking](https://daily.dev/tags/networking), [#ansible](https://daily.dev/tags/ansible), [#bgp](https://daily.dev/tags/bgp)

[View this post on daily.dev](https://daily.dev/posts/how-i-automated-my-network-with-ansible-tpdinhymv)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How I Automated my Network with Ansible","url":"https://daily.dev/posts/how-i-automated-my-network-with-ansible-tpdinhymv","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-i-automated-my-network-with-ansible-tpdinhymv"},"datePublished":"2026-08-11T08:56:28.076Z","dateModified":"2026-08-11T09:19:44.335Z","description":"A hands-on walkthrough of automating a personal BGP network (AS201726) with Ansible after adding a third POP and fourth router. Covers the full Ansible setup:...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3fdb2ba8c316113a5758e2adac65bcc9?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3fdb2ba8c316113a5758e2adac65bcc9?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"apalrd's adventures","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"apalrd's adventures","logo":"https://media.daily.dev/image/upload/s--4zkx8dRj--/f_auto,q_auto/v1786438309/logos/apalrd?_a=BAMAMicg0","url":"https://daily.dev/sources/apalrd"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-i-automated-my-network-with-ansible-tpdinhymv","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"networking,ansible,bgp","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"apalrd's adventures","item":"https://daily.dev/sources/apalrd"},{"@type":"ListItem","position":3,"name":"How I Automated my Network with Ansible"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-i-automated-my-network-with-ansible-tpdinhymv#faq","mainEntity":[{"@type":"Question","name":"How do I use Ansible to dynamically pull IPv6 addresses from Netbox for BGP peer configuration?","acceptedAnswer":{"@type":"Answer","text":"Use the netbox.netbox.nb_lookup plugin to query virtual-machines from Netbox, then build a map of VM name to primary_ip6 address using set_fact and combine(). You can then fail the playbook early if any expected peer is missing from the map. This approach lets Netbox serve as the source of truth for IP addresses rather than hardcoding them in inventory. Engineers building network automation pipelines track Netbox and Ansible integration patterns on daily.dev."}},{"@type":"Question","name":"How do I configure systemd-networkd to create IPv6-in-IPv6 tunnel interfaces between routers?","acceptedAnswer":{"@type":"Answer","text":"Create a .netdev file with Kind=ip6tnl and Mode=ip6ip6, setting Local and Remote to each router's primary IPv6 address. Pair it with a .network file matching the interface name and assigning a link-local address. Ansible templates can generate these files per peer dynamically, then trigger a networkctl reload handler to apply changes without a full restart. Homelab network builders working with systemd-networkd tunnel configs share setups like this on daily.dev."}},{"@type":"Question","name":"How do I template BIRD3 iBGP full-mesh configuration with Jinja2 in Ansible?","acceptedAnswer":{"@type":"Answer","text":"Store each router's router_id and peers list in the Ansible inventory, then use a Jinja2 for loop over the peers variable in the bird-ibgp.conf template. Each iteration generates a protocol bgp block using the peer's router_id for the neighbor address and host name for the protocol identifier. A birdc configure handler reloads BIRD after any template change. Developers automating BGP routing configs with BIRD and Ansible find peer implementations on daily.dev."}}]}
```

