Skip to content

[Imprv] Resolve inventory plugin categories to key/value pairs #963

@andrew-sumner

Description

@andrew-sumner

Summary

The ntnx_prism_vm_inventory_v2 inventory plugin currently exposes VM categories as a list of ext_ids, which are not useful for grouping or filtering. This improvement resolves category ext_ids to their human-readable key/value pairs by fetching the category details from the Prism v4 API.

Additionally, the automatic cluster group creation (which uses the raw cluster ext_id as the group name) cannot be disabled. A new auto_create_cluster_groups option allows users to disable this and use keyed_groups with cluster_name for human-readable groups instead.

Changes

  • Resolve category ext_ids to {key: value} dicts in VM hostvars (e.g. {"Organisation": "C785"})
  • Add get_categories_api_instance helper to prism api_client
  • Add auto_create_cluster_groups option (default true for backwards compatibility)

Use case

With resolved categories, users can create meaningful inventory groups:

keyed_groups:

  • key: categories.Organisation
    prefix: org
    separator: "_"

This creates groups like org_C785 that can be used with --limit or in playbook hosts patterns.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions