Update for new netbox setup.
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user