r/homelab•
har8yun

Automate BIND9 DNS with Infrastructure as Code: Open-source REST API, Terraform/OpenTofu Provider, Ansible Role

Blog

Managing BIND9 zone files by hand doesn't scale — every change means SSH, editing configs, reloading, and hoping nothing breaks.

Detailed article about the journey and architecture: https://medium.com/dev-genius/automating-bind9-dns-management-from-manual-configs-to-infrastructure-as-code-84292214b5a5

Three open-source tools that solve this:

  • bind9-api — REST API on top of BIND9 (zones, records, ACLs, DNSSEC, Prometheus metrics)
  • Terraform Provider — manage DNS as code with plan/apply workflow, supports single and multi-primary architectures
  • Ansible Role — one-command deployment of BIND9 + API

Architecture: Ansible handles infrastructure (install/deploy), Terraform handles content (zones/records). Each tool does what it's best at.

All Apache 2.0:

Posted Mar 27, 2026, 8:07 PM UTC

01
Loading comments…