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.
- A working netbox installation
- A domain with nameservers of one of the providers supported by octo-dns
In the config
folder you find 2 items, the config.yaml
file and the domains
folder.
- 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.
- 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.
- If you use a different provider, make sure you add the module to
requirements.txt
- 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.
- 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
To test the container locally, execute the following command:
curl -X POST http://localhost:8080/sync -H "API-Key: YOUR_API_KEY"
Navigate to Operations => Webhooks
and add a new webhook like this: