Update for new netbox setup.

This commit is contained in:
2024-01-18 16:19:43 +00:00
parent 9c1de65e4c
commit a68b475115
3 changed files with 4 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
. ./config.sh
do_curl() {
curl -s -k -H "Authorization: Token ${TOKEN}" -X GET $1
curl -s -k -H "Host: netbox.v.paler.net" -H "Authorization: Token ${TOKEN}" -X GET $1
}
echo "# generated by $0 at $(date)"
@@ -11,7 +11,7 @@ echo
cat dhcpd.conf.head
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' |
jq -r ".results[] | .assigned_object.device.name + .assigned_object.virtual_machine.name + \" \" + (.address / \"/\")[0] + \" \" + (.assigned_object.url | sub(\"netbox.v.paler.net\"; \"${NETBOX}\"))" |
while read name ip owner
do
mac=$(do_curl $owner | jq -r '.mac_address')