Change a design the rack uses
Change the server design the rack is built from, see which racks follow it and why, and how to pin one that shouldn't.
The compute rack is built from two device designs. This chapter changes one of them, the server, and watches what the racks do about it. They follow it, because the rack refers to the server design by name alone; the chapter ends with how to make a rack not follow, by pinning the reference to a version.
Try to delete it
- Open
devices/Dell_R640_w_modulein the catalogue. Its Used by tab liststutorial/compute_rack. - Select Delete.
The button says the design can't be deleted and names the rack: a design that other designs are built from stays until they no longer refer to it. Select Cancel.
Change it
Add a description to the server. Here is the whole design with the one new line, description: Compute server, under the device's status, so you can paste it rather than edit the copy from The compute rack:
name: Dell_R640_w_module
netbox_versions: ["4.6.*", "4.7.*"]
description: Dell PowerEdge R640 with Intel X710-DA4 10GbE NIC
variables:
name: $USER
slug: $USER
position: $USER_OPTIONAL
face: $USER_OPTIONAL
status: $USER
serial: $USER_OPTIONAL
site: $USER
rack: $USER_OPTIONAL
infra:
- infra_type: Device
name: '{{ variables.name }}'
slug: '{{ variables.slug }}'
position: '{{ variables.position }}'
face: '{{ variables.face }}'
status: '{{ variables.status }}'
description: Compute server
serial: '{{ variables.serial }}'
site: '{{ variables.site }}'
role:
infra_type: DeviceRole
name: Compute Server
slug: compute-server
color: 4caf50
rack: '{{ variables.rack }}'
device_type: 'dtl:device-types/Dell/PowerEdge-R640.yaml@fdf12828'
modules:
- infra_type: Module
device: '{{ parent }}'
module_bay: "{{ nbd.nbt.get_module_bay(parent, 'PCIE1') }}"
module_type: 'dtl:module-types/Intel/X710-DA4.yaml@fdf12828'
module_position: PCIE1- On the design's page, select Edit, replace the YAML with the one above, type
1.1.0as the version label, and select Save.
The page shows v1.1.0. Go to Deployments: rack-r1 and rack-r2 each say that a design they are built from has changed since they were applied, naming devices/Dell_R640_w_module. The rack design itself hasn't changed, so neither says the design has changed; what changed is underneath it.
Check for drift first
Select Check drift on rack-r2: it's in sync. A drift check compares NetBox with exactly what the deployment applied, the server design included, at the version it was then. A design edited in the catalogue is never mistaken for someone changing NetBox; the Deployments page says which of the two happened.
Redeploy one rack
- Open
rack-r2and select Redeploy. The deploy page opens at the rack version it applied, and offers no newer one: the rack design is as it was. - Select Plan.
The plan has 10 Update: a description on each of rack R2's ten servers. The rack's reference, nbd:devices/Dell_R640_w_module, names no version, so when the rack is planned again it takes whatever version of the server design the catalogue holds. That is what the Deployments page warned of, and it is what you want when a design is a shared part: fix the part once, and every rack picks it up the next time it's planned.
Apply it. In NetBox, R2's servers have the description and R1's don't. On the Deployments page, rack-r2 no longer says a design it's built from has changed; rack-r1 still does, and will until it's redeployed. Select Check drift on rack-r1: in sync. It compares against the server design at v1.0.0, the version it applied, so the catalogue's newer version doesn't count as drift there either.
Pinning a reference
A rack that must not follow the server design pins it: design: nbd:devices/Dell_R640_w_module@1.0.0 names a version, by its label or its content hash, and the rack renders with that version until someone changes the pin. A pinned version can't be removed from the catalogue, or relabelled, while a design points at it. The Device Type Library references in these designs work the same way: @fdf12828 is a pin. The tutorial leaves the rack unpinned, so the next chapters have one version of everything to work with. Composition has the rules.
Why not put it back
In the last chapter you put the rack design back and the deleted server came back with it. The description doesn't work that way. If you pasted the original server design again, the catalogue would recognise it as v1.0.0 and make it current, rack-r2 would say a design it's built from had changed, and redeploying it would plan nothing: a design only manages the fields it states, so a field it stops stating is left as NetBox has it, and the ten descriptions would stay. The Review step would offer Record version, naming the server design at its v1.0.0 hash; applying that changes nothing in NetBox and only records which design rack-r2 is now built from, which clears the notice. The same rule is why, in the next chapter, a comment someone types into NetBox isn't drift.
So the tutorial leaves the server design at v1.1.0. The next chapters don't mind: a rack planned from now on gets servers with the description, and the counts are the same.
Next, check for drift: what happens when NetBox changes under a deployment.