Docs
Tutorial

Change the design

Remove a server from the compute rack design, redeploy rack R2, and follow the deletes through to NetBox.

To change what a deployment builds, you change its design in the catalogue and plan the deployment again. This chapter takes one server out of the rack design, redeploys rack-r2, and follows the delete through to NetBox. Rack R1 is untouched: it's another deployment.

Versions

Edit on a design's page replaces its YAML. The catalogue keeps every version a design has had, and a version is its content: the same YAML is the same version whatever you label it, and a label names one content. Each deployment records which version it applied, and the Deployments page says when the design has changed since. The design's name doesn't change, so the designs that use it and the deployments made from it carry on.

Change the design

In the compute rack, three loops run once per server: the servers, their data cables and their management cables. Each has over: {start: 1, end: 10}. The changed design has end: 9 in all three, and nothing else is different. Here it is in full, so you can paste it rather than edit the copy from The compute rack:

name: Compute Rack
netbox_versions: ["4.6.*", "4.7.*"]
description: A 42U compute rack in an existing site, with a top-of-rack switch, ten servers and their cabling.
variables:
  rack_name: $USER
  site_slug: $USER
  status: active
infra:
- infra_type: Rack
  name: '{{ variables.rack_name }}'
  site: '{{ variables.site_slug }}'
  rack_type: dtl:rack-types/APC/AR3350.yaml@fdf12828
  status: '{{ variables.status }}'
  devices:
  - design: nbd:devices/Cisco_3850_w_module
    template_vars:
      name: '{{ variables.rack_name }}-TOR-01'
      slug: '{{ variables.rack_name }}-tor-01'
      position: 42
      face: front
      status: active
      site: '{{ parent.site }}'
      rack: '{{ parent }}'
  - nbd_loop:
      over: {start: 1, end: 9}
      as: i
    design: nbd:devices/Dell_R640_w_module
    template_vars:
      name: '{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}'
      slug: '{{ variables.rack_name }}-compute-{{ loop.i | zeropad }}'
      position: '{{ loop.i }}'
      face: front
      status: active
      site: '{{ parent.site }}'
      rack: '{{ parent }}'
  cables:
  - nbd_loop:
      over: {start: 1, end: 9}
      as: i
    items:
    - infra_type: Cable
      label: '{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}-DATA-A'
      type: cat6a
      status: connected
      termination_a: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}', 'Interface', 'Ethernet/PCIE1/1') }}"
      termination_b: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-TOR-01', 'Interface', 'GigabitEthernet1/0/{{ loop.i * 2 - 1 }}') }}"
    - infra_type: Cable
      label: '{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}-DATA-B'
      type: cat6a
      status: connected
      termination_a: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}', 'Interface', 'Ethernet/PCIE1/2') }}"
      termination_b: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-TOR-01', 'Interface', 'GigabitEthernet1/0/{{ loop.i * 2 }}') }}"
  - nbd_loop:
      over: {start: 1, end: 9}
      as: i
    infra_type: Cable
    label: '{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}-MGMT'
    type: cat6
    status: connected
    termination_a: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}', 'Interface', 'iDRAC9') }}"
    termination_b: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-TOR-01', 'Interface', 'GigabitEthernet1/0/{{ loop.i + 20 }}') }}"

If only one or two of the loops change, the plan won't match what this chapter describes: a server with no cables, or cables to a server that isn't there.

Edit it in the catalogue

  1. Open tutorial/compute_rack in the catalogue and select Edit.
  2. Replace the YAML with the changed design. The dialog says it will be saved as a new version.
  3. Type 1.1.0 as the version label and select Save.

The page shows v1.1.0. Go to Deployments: rack-r1 and rack-r2 each say the design has changed since they were applied, from v1.0.0 to v1.1.0. Nothing in NetBox has changed yet; a deployment changes when you plan and apply it.

Redeploy rack R2

  1. Go to Deployments, open rack-r2, and select Redeploy. The deploy page opens on that deployment, with the variables it was applied with, at the version it applied: under the design it says Version applied: v1.0.0, and that the catalogue has a newer version, v1.1.0.
  2. Select Plan the newer version. A deployment stays at the version it applied until you choose to move it, so planning without this step would find nothing to do.
  3. Select Plan.

Why R2

If you deployed into a branch in chapter 5, there are two deployments named rack-r1: the one you released on the branch, under All, and the one on main. rack-r2 has one deployment, on main, so there is no mistaking which to open.

The plan has 0 Create, 0 Update, 20 Delete. It deletes server R2-COMPUTE-10 and what's part of it: the device, its network card, its nine interfaces, its two power ports and its console port, its three module bays, and its three cables. Every one of them is a delete of its own in the plan, because the design declared each of them, so nothing happens in NetBox that the plan doesn't show. When a delete would reach something the plan doesn't list, say the prefixes scoped to a site that goes, the plan says so under the delete that causes it, and applying asks you to accept that first; Read a plan has the details. This plan has nothing of the kind.

The three cables leave three ports free on the switch. That isn't a change to the switch: in Designs a cable is the whole of a connection, and a port is just a port whether or not a cable ends on it.

Apply it

Apply the plan. In NetBox, rack R2 holds nine servers, and its switch's ports GigabitEthernet1/0/19, GigabitEthernet1/0/20 and GigabitEthernet1/0/30 are free. Rack R1 still has ten.

Open rack-r2 on the Deployments page: it owns 251 objects now, applied from v1.1.0, so it no longer says the design has changed. rack-r1 still does: it was applied from v1.0.0 and still has ten servers. Select Check drift on rack-r2: it's in sync. Check drift compares NetBox with the version the deployment applied, v1.1.0, so a design edit is never mistaken for drift; rack-r1 is in sync too, against v1.0.0.

Put it back

Edit the design again and paste the original, which has end: 10 in all three loops. Leave the version label empty: the catalogue recognises the content as v1.0.0, the version it already has, and makes it current again. It's the design from The compute rack, repeated here so you can paste it:

name: Compute Rack
netbox_versions: ["4.6.*", "4.7.*"]
description: A 42U compute rack in an existing site, with a top-of-rack switch, ten servers and their cabling.
variables:
  rack_name: $USER
  site_slug: $USER
  status: active
infra:
- infra_type: Rack
  name: '{{ variables.rack_name }}'
  site: '{{ variables.site_slug }}'
  rack_type: dtl:rack-types/APC/AR3350.yaml@fdf12828
  status: '{{ variables.status }}'
  devices:
  - design: nbd:devices/Cisco_3850_w_module
    template_vars:
      name: '{{ variables.rack_name }}-TOR-01'
      slug: '{{ variables.rack_name }}-tor-01'
      position: 42
      face: front
      status: active
      site: '{{ parent.site }}'
      rack: '{{ parent }}'
  - nbd_loop:
      over: {start: 1, end: 10}
      as: i
    design: nbd:devices/Dell_R640_w_module
    template_vars:
      name: '{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}'
      slug: '{{ variables.rack_name }}-compute-{{ loop.i | zeropad }}'
      position: '{{ loop.i }}'
      face: front
      status: active
      site: '{{ parent.site }}'
      rack: '{{ parent }}'
  cables:
  - nbd_loop:
      over: {start: 1, end: 10}
      as: i
    items:
    - infra_type: Cable
      label: '{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}-DATA-A'
      type: cat6a
      status: connected
      termination_a: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}', 'Interface', 'Ethernet/PCIE1/1') }}"
      termination_b: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-TOR-01', 'Interface', 'GigabitEthernet1/0/{{ loop.i * 2 - 1 }}') }}"
    - infra_type: Cable
      label: '{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}-DATA-B'
      type: cat6a
      status: connected
      termination_a: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}', 'Interface', 'Ethernet/PCIE1/2') }}"
      termination_b: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-TOR-01', 'Interface', 'GigabitEthernet1/0/{{ loop.i * 2 }}') }}"
  - nbd_loop:
      over: {start: 1, end: 10}
      as: i
    infra_type: Cable
    label: '{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}-MGMT'
    type: cat6
    status: connected
    termination_a: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-COMPUTE-{{ loop.i | zeropad }}', 'Interface', 'iDRAC9') }}"
    termination_b: "{{ nbd.lookup.endpoint('{{ variables.rack_name }}-TOR-01', 'Interface', 'GigabitEthernet1/0/{{ loop.i + 20 }}') }}"

The design's page shows v1.0.0 again, and on the Deployments page it is rack-r2 that says the design has changed. Redeploy it, select Plan the newer version as before, and plan: 20 creates, and server 10 is back with its card and cables. The rest of the tutorial expects ten servers in each rack.

Next, change a design the rack uses: the server design, and which racks follow it.

On this page