Skip to content

jhuesser/octodns-webhook-listener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

octodns-webhook-listener

Github last-commit Docker Pulls Docker Image Size

This is a simple flask app, which exposes Octo-dns as a webhook. My goal is, that when I add a new DNS entry in netbox, the DNS entry should be automaticlly be created on the DNS server.

How to get this thing running

Requirements

  1. A working netbox installation
  2. A domain with nameservers of one of the providers supported by octo-dns

Config

In the config folder you find 2 items, the config.yaml file and the domains folder.

  1. add a yaml file for your domain to the domains folder. Configure the default values for your domain, that are not managed by netbox (eg. MX records.)

IMPORTANT: All DNS records will be lost, if not present in netbox or the yaml file! Consider using octodns-dump to create the initial config.

  1. Edit the config.yaml file according to your needs. Currently it's configured to get the data from the yaml file & netbox and push it to digital ocean. If you want to use this setup, just fill in your digital ocean and netbox token, as well as the netbox URL. How to configure a basic setup

Those 2 steps are no different from a basic octo-dns setup, you can check their documentation on how to do it.

  1. If you use a different provider, make sure you add the module to requirements.txt
  2. Generate a random string to use as API key of this container. You need to include this API key in every request to the flask app.
  3. Run it:
docker run -d --name octodns-webhook \
-v ./config/:/opt/octodns-webhook/config \
-v ./requirements.txt:/opt/octodns-webhook/requirements.txt \
-e API_KEY=<YOUR_API_KEY> \
-p 8080:8080 \
jhuesser/octodns-webhook-listener:latest

Test

To test the container locally, execute the following command:

curl -X POST http://localhost:8080/sync -H "API-Key: YOUR_API_KEY"

Add to netbox

Navigate to Operations => Webhooksand add a new webhook like this: WebhookConfig

After that add an event to trigger the webhook: EventRule

About

A webhook that triggers octodns-sync on calling

Resources

License

Stars

Watchers

Forks

Packages

No packages published