Initial commit.

This commit is contained in:
2025-06-16 06:11:19 +02:00
commit 3885c79b91
5 changed files with 157 additions and 0 deletions

17
query-netbox.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/bash
. /root/.netbox-token
# Build DNS data file from NetBox
curl -s \
-H "Accept: application/json; indent=2" \
-H "Authorization: Token $NETBOX_TOKEN" \
"https://netbox.koszewscy.waw.pl/api/ipam/ip-addresses/" | \
jq -r '.results[] | select(.dns_name!="") | [(.address | split("/"))[0], .dns_name] | @tsv' | \
while read ip name
do
echo "address=/$name/$ip"
done > /etc/dnsmasq.d/netbox.conf
# Restart the DNSMasq service
systemctl restart dnsmasq.service