#!/bin/sh . ./config.sh do_curl() { curl -s -k -H "Authorization: Token ${TOKEN}" -X GET $1 } echo "# generated by $0 at $(date)" echo cat dhcpd.conf.head do_curl "https://${NETBOX}/api/ipam/ip-addresses/" | \ jq -r '.results[] | .assigned_object.device.name + .assigned_object.virtual_machine.name + " " + (.address / "/")[0] + " " + .assigned_object.url' | while read name ip owner do mac=$(do_curl $owner | jq -r '.mac_address') cat<