From 9c1de65e4c1cd05ae295edd97fdf4b1145c6f06a Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Fri, 9 Dec 2022 06:52:12 +0000 Subject: [PATCH] Raise netbox API pagination limit so that all devices are included. --- netbox-dhcp.sh | 2 +- netbox-dns.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox-dhcp.sh b/netbox-dhcp.sh index 4c99fed..b3fde82 100755 --- a/netbox-dhcp.sh +++ b/netbox-dhcp.sh @@ -10,7 +10,7 @@ echo "# generated by $0 at $(date)" echo cat dhcpd.conf.head -do_curl "https://${NETBOX}/api/ipam/ip-addresses/" | \ +do_curl "https://${NETBOX}/api/ipam/ip-addresses/?limit=10000" | \ jq -r '.results[] | .assigned_object.device.name + .assigned_object.virtual_machine.name + " " + (.address / "/")[0] + " " + .assigned_object.url' | while read name ip owner do diff --git a/netbox-dns.sh b/netbox-dns.sh index 35327ae..9bee1b5 100755 --- a/netbox-dns.sh +++ b/netbox-dns.sh @@ -4,6 +4,6 @@ RPZ_FILE=/var/unbound/db/local.rpz -curl -s -k -H "Authorization: Token ${TOKEN}" -X GET "https://${NETBOX}/api/ipam/ip-addresses/" | \ +curl -s -k -H "Authorization: Token ${TOKEN}" -X GET "https://${NETBOX}/api/ipam/ip-addresses/?limit=10000" | \ jq -r '.results[] | (.address / "/")[0] as $addr | (.assigned_object.device.name + .assigned_object.virtual_machine.name + ".home.paler.net") as $name | ($addr | split(".") | reverse | join(".") + ".in-addr.arpa") as $rev | $name + " A " + $addr, $rev + " PTR " + $name + "."' | \ tee ${RPZ_FILE}