infrahub-managing-objects

Creates and validates Infrahub object YAML files for populating infrastructure data.

9|2|Updated Aug 27, 2025
One-click install
npx skills add https://github.com/opsmill/infrahub-solution-ai-dc --skill infrahub-managing-objects-opsmill
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: infrahub-managing-objects
Source: https://github.com/opsmill/infrahub-solution-ai-dc/tree/main/.agents/skills/infrahub-managing-objects
Command: npx skills add https://github.com/opsmill/infrahub-solution-ai-dc --skill infrahub-managing-objects-opsmill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing Infrahub object data files by hand is error-prone: wrong envelope structure, mismatched human_friendly_id reference shapes, dropdown label/name confusion, and broken load ordering all cause silent or hard load failures. This Skill guides the creation of correct object YAML files for devices, locations, organizations, and modules. ## Core Features & Use Cases - Object File Authoring: Produces correctly structured apiVersion: infrahub.app/v1 / kind: Object YAML documents with proper attribute value mapping, dropdown choice names, and relationship references by human_friendly_id. - Hierarchy and Component Nesting: Handles inline children for location trees (Region > Site > Room > Rack) and component children like device interfaces, including expand_range interface expansion. - Branch-First Loading Workflow: Enforces validating and loading objects onto a dedicated branch with infrahubctl object validate and object load --branch instead of writing directly to the default branch. - Use Case: You need to populate a new Infrahub instance with manufacturers, device types, a location hierarchy, and 50 servers with interfaces. The Skill generates numbered object files in dependency order, validates them against a branch, and hands off the load commands. ## Quick Start Ask the assistant to create an Infrahub object file for a specific kind, for example: create a DcimDevice object file for spine-01 with its device type, rack, and interfaces.

Frequently Asked Questions about infrahub-managing-objects

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create Infrahub object YAML files for devices?▼

Write a YAML document with apiVersion: infrahub.app/v1, kind: Object, and a spec block containing the schema node kind and a data list of instances. Reference related objects like device types and racks by their human_friendly_id, then load with infrahubctl object load.

How do I reference related objects in Infrahub object files?▼

Reference targets by their human_friendly_id: a scalar value for single-element HFIDs like manufacturer names, or a YAML list for multi-element HFIDs like rack references containing room shortname and rack name. List element order must match the target schema's HFID declaration.

Why does my Infrahub object load fail with dropdown value errors?▼

Dropdown attributes must use the choice name, not the display label. If the schema declares a choice with name 'active' and label 'Active', the object file must set status: active; using the label causes a hard validation rejection at load time.

Can I load Infrahub objects directly to the main branch?▼

Loading without --branch writes to the default branch, which is risky on shared servers because object loads are not transactional across files. Create a dedicated branch, validate and load with --branch, then merge through a proposed change.

How do I define hierarchical locations in Infrahub object files?▼

Nest children inline under a children block with an explicit kind field at each level, such as LocationRegion containing LocationSite containing LocationRoom. The kind field is required because the loader cannot infer the concrete type from a hierarchical generic.

When should I not use Infrahub object files?▼

Object files are for populating data instances, not for designing schemas, writing Python checks or generators, or querying live data. Bootstrap definitions like CoreRepository should also live outside the objects directory to avoid re-applying on every git sync.