Skip to content

Add ansible-inventory credential support for save command #2924

@fullstopdev

Description

@fullstopdev

Summary

Add support for loading SSH/NETCONF credentials from the auto-generated ansible-inventory.yml file during containerlab save operations.

Motivation

Currently, the save command uses default credentials from the node registry. When users have configured their lab nodes with custom credentials (documented in the ansible inventory), the save command fails because it doesn't use those credentials.

Proposed Solution

  • Parse ansible-inventory.yml from the lab directory
  • Extract per-node or per-kind credentials
  • Inject credentials into node config before calling SaveConfig()
  • Skip nodes that don't need credentials (linux, bridge, etc.)

Implementation Details

  • Create `core/inventory_reader.go for parsing ansible inventory
  • Modify core/save.go to load and apply credentials
  • Use dynamic approach: only skip node kinds that explicitly don't need credentials
  • Credentials loaded in-memory only, not persisted to topology

Benefits

  • Seamless integration with existing ansible-inventory workflow
  • Per-node or per-kind credential support
  • Backwards compatible (falls back to defaults if inventory not found)
  • No changes to topology files required

Additional Context

This feature complements the existing ansible inventory generation and makes the save workflow more robust when working with customized lab credentials.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions