Skip to content

opsmill/infrahub-rack-elevation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rack Elevation for Infrahub

Community Contribution — This project was originally authored by OpsMill community member Jordy.

What Is It?

This project provides a native way to generate rack elevation diagrams in Infrahub. It includes the schema definitions and transform logic needed to represent and render the physical layout of devices within a rack — directly inside your Infrahub instance.

This is not a plugin or a traditional extension. It's a self-contained set of resources (schemas, transforms, artifacts) that you can load into any Infrahub deployment using built-in platform features — no custom code or patching required.

rack elevation artifact

Why Should I Care?

If you manage physical infrastructure, you know that keeping track of what sits where in a rack is critical — for capacity planning, cable management, power budgeting, and change operations.

Rack Elevation gives you:

  • A visual representation of device placement within racks, with accurate U-position mapping.
  • A single source of truth — rack layout lives alongside the rest of your infrastructure data in Infrahub, not in a separate spreadsheet or tool. Changes made in Infrahub are automatically reflected in the rack elevation.
  • Integration ready — generates a valid SVG file that you can query via the Infrahub API and display or share anywhere.
  • Version control and branching — because it's native Infrahub data, your rack layouts benefit from the same Git-like workflow as everything else: branches, proposed changes, diff, and merge. You can view rack elevations as they were weeks ago.

Getting Started

Following the Infrahub philosophy, we give you direct access to the source code. It takes a bit more effort to integrate, but you have full control and can fine-tune it to fit your exact needs.

See more details in the Infrahub Artifact Guide.

Schema

Important

If you are not using the schema library, refer to the schema integration guide to integrate rack elevation into your project.

If you are using the schema library, the only schema change required is ensuring your LocationRack node inherits from the CoreArtifactTarget generic.

  - name: Rack
    namespace: Location
    inherit_from:
+     - CoreArtifactTarget

racks group

Create a StandardGroup named racks and add all the rack objects you want a rack elevation artifact for.

In the UI, go to Object Management > Groups.

infrahub.yml

Make sure you have copied all files to the corresponding folders in your Infrahub repository. You can adjust the naming in the next step, but ensure all files are in place as follows:

.
├── transforms/
│   ├── rack_svg.py
│   └── rack_elevation.svg.j2
├── schemas/
└── queries/
    └── rack_visualization.gql

Then add the following to your .infrahub.yml file:

---
artifact_definitions:
  - name: rack_elevation
    artifact_name: rack_elevation
    content_type: image/svg+xml
    targets: racks
    transformation: rack_elevation
    parameters:
      name: name__value

python_transforms:
  - name: rack_elevation
    class_name: RackElevationTransform
    file_path: transforms/rack_svg.py

queries:
  - name: rack_elevation_query
    file_path: queries/rack_visualization.gql

Running the transform

To confirm everything works, run the transform to get the SVG output.

uv run infrahubctl transform rack_elevation name=my-rack --branch "main"

This returns the full SVG string, which you can paste into any SVG viewer to inspect the result.

Tip

You should be all set for the initial setup. Push everything to the Git repository connected to your Infrahub instance, then move on to the usage section below.

Usage

This follows standard artifact/transform usage in Infrahub.

Confirm import from Git

First, make sure the new query and transform have been imported from Git. You can verify this under Integrations > Git repositories by clicking on your repository.

Generate a rack elevation

  1. Create a branch.
  2. Add a rack to the racks group created earlier.
  3. Open a proposed change.
    • Alternatively, go to Actions > Artifact Definition to force generation.
  4. Wait for the tasks to complete.

Tip

Open the detailed view of your rack. In the Artifacts tab you should find the rack elevation artifact.

Contributing

This is a community-driven project. If you'd like to contribute — whether it's fixing a bug or improving the visualization — feel free to open an issue or submit a pull request.

Resources

About

Rack elevation for Infrahub.

Topics

Resources

Stars

Watchers

Forks

Contributors