Renamed Shell prototype.
This commit is contained in:
17
netbox-dns-updater.sh
Normal file
17
netbox-dns-updater.sh
Normal 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
|
Reference in New Issue
Block a user