NetBox device sync; lab NetBox container
ipam.device_sync mirrors commissioned machines as dcim devices: serial, device type and role (created when missing), status, interfaces with MAC objects, Rollcall's addresses assigned to them and the management address as primary IP. Site, location and rack are matched by name from the machine's location and never created. Ownership by tag and rollcall_machine; a foreign device of the same name is a conflict. lab/netbox/install.sh sets up a NetBox on the lab segment so the drivers are tested without writing to a real NetBox. Refs #10 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5688314b5
commit
133b5f38d9
6 files changed
+982
-8
No files matched your search
@@ -788,6 +788,40 @@ rollcall ipam sync
|
||||
rollcall ipam prefixes | import
|
||||
```
|
||||
|
||||
### Devices in NetBox
|
||||
|
||||
With `device_sync` in the `ipam` block, the NetBox driver also keeps every
|
||||
commissioned machine as a `dcim` device:
|
||||
|
||||
```json
|
||||
"ipam": { "provider": "netbox", ..., "device_sync": { "site": "dc1", "role": "server" } }
|
||||
```
|
||||
|
||||
- **What is written.** Name (node name, else the machine ID), serial, status
|
||||
(deployed/booted/stateless are `active`, commissioned ones `staged`, failed
|
||||
jobs `failed`), the device type from the DMI manufacturer and product, the
|
||||
role (default `server`), interfaces with their MACs (NetBox 4.2+ MAC objects,
|
||||
set as primary MAC), Rollcall's addresses assigned to those interfaces, and
|
||||
the management address as primary IP. Machines still `new` are skipped.
|
||||
- **Location comes from NetBox.** The machine's building, room and rack are
|
||||
matched by name to a site, a location and a rack (in that site); the unit
|
||||
becomes the rack position, the asset tag the device's. Rollcall never creates
|
||||
sites, locations or racks; a machine whose building matches no site goes to
|
||||
`device_sync.site`, which must exist. Manufacturers, device types and the role
|
||||
are created when missing (a device needs them).
|
||||
- **Ownership as for addresses.** Devices carry the tag `rollcall` and the
|
||||
machine ID in `rollcall_machine` (enable the field for devices too). A device
|
||||
of the same name without them is reported as a conflict and left alone;
|
||||
Rollcall's devices whose machine is gone are deleted. Interfaces are removed
|
||||
only when they carry the tag.
|
||||
- **It runs after the address reconcile**, in the same loop; `rollcall ipam
|
||||
sync` reports both (`devices` in the JSON).
|
||||
|
||||
The NetBox user needs `view/add/change/delete` on `dcim.device`,
|
||||
`dcim.interface` and `dcim.macaddress`, `view/add` on `dcim.manufacturer`,
|
||||
`dcim.devicetype` and `dcim.devicerole`, and `view` on `dcim.location` and
|
||||
`dcim.rack`, on top of the IPAM permissions.
|
||||
|
||||
The provider is an interface (reserve, owned records, update, delete,
|
||||
delegated prefixes); the NetBox driver is the first. An Infoblox WAPI driver
|
||||
maps them to `record:host`/`fixedaddress` with extensible attributes.
|
||||
|
||||
Reference in new issue
Block a user