Saved Connections and Inventory

In enterprise usage, saved connections become the operational backbone of rauto.

They are not just convenience shortcuts. They are the source of truth for:

  • reusable target definitions
  • inventory grouping
  • orchestration targeting
  • long-term session records

Why saved connections matter

Ad-hoc flags are fine at the beginning:

rauto exec "show version" \
  --host 192.168.1.1 \
  --credential network-admin \
  --device-profile cisco_ios

But enterprise workflows quickly need:

  • shorter and safer command lines
  • reusable target naming
  • stable inventory selection for jobs and orchestration
  • consistent device profile assignment
  • searchable device model and software version metadata
  • auditable history bound to known targets

That is where saved connections become essential.

Core connection lifecycle

Add or update a saved connection

rauto connection add lab1 \
  --host 192.168.1.1 \
  --credential network-admin \
  --ssh-port 22 \
  --ssh-security balanced \
  --device-profile cisco_ios

Reuse a saved connection

rauto exec "show version" --connection lab1

Inspect and delete

rauto connection list
rauto connection show lab1
rauto connection delete lab1

Device facts

Saved connections can persist two optional device facts:

  • device_model
  • software_version

The Web connection editor lets you enter either value manually or detect both from the target. Detection resolves the effective device Profile, executes its version show object, and extracts facts from the NTC/TextFSM result. If parsing returns only one fact, the editor reports a partial result and preserves the existing manual value for the missing field.

The saved connection catalog includes model and version in its searchable summary, so operators can locate targets by platform details as well as by name, host, groups, or labels.

Save effective connection after success

rauto connection test \
  --connection lab1 \
  --save-connection lab1_backup

Credential reference rules

Authentication now lives in reusable device credentials rather than connection records.

  • every new saved connection must reference an existing credential
  • saved connections store credential_id, not usernames or passwords
  • --credential <name-or-id> selects authentication for a direct target
  • --save-connection preserves the effective credential reference
  • credential ciphertext is encrypted in rauto.db; the master key stays in the system keyring
  • a referenced credential cannot be deleted until connections release it

Operational implication:

  • database backups move connection metadata and credential ciphertext
  • the operating-system keyring master key is not included, so cross-machine restores may require credentials to be saved again

See Device Credentials for lifecycle and import commands.

Bulk import

Bulk import is one of the most important enterprise onboarding features.

rauto connection import ./devices.csv
rauto connection import ./devices.xlsx

Supported file types:

  • .csv
  • .xlsx
  • .xls
  • .xlsm
  • .xlsb
name,host,credential,port,connect_timeout_secs,device_model,software_version,ssh_security,linux_shell_flavor,device_profile,template_dir
core-sw-01,192.168.1.1,network-admin,22,30,C9300-48P,17.9.5,balanced,,cisco_ios,
linux-jump-01,192.168.1.10,linux-ops,22,30,,,secure,posix,linux,

Import behavior

From the README and current docs:

  • import uses upsert semantics by connection name
  • if name is omitted, it can be derived from host
  • credential must name an existing unique credential; connection import does not create credentials
  • omitting credential preserves the reference for an existing connection, while a new connection requires one
  • device facts accept device_model / software_version headers and common aliases such as model, hardware, os_version, and version
  • Web UI also exposes a starter CSV download flow

Repository sample files:

  • templates/examples/connection-import-template-en.csv
  • templates/examples/connection-import-template-zh.csv

Session record model

Saved connections can be used to filter unified session records.

Current CLI support:

rauto session list lab1 --limit 20
rauto session show <record-id>
rauto session replay --id <record-id> --list
rauto session delete <record-id>

This matters in enterprise environments because session records are easier to interpret when bound to a stable saved target instead of transient ad-hoc flags.

Inventory model

There is no separate persistent inventory target record layer anymore.

Instead:

  • saved connections are the inventory target source of truth
  • inventory CLI focuses on group management

This is a subtle but important design decision.

It means the target identity model stays unified:

  • one saved connection entry
  • reused by CLI execution
  • reused by Web UI
  • reused by groups
  • reused by orchestration

Group management

Current group operations:

rauto inventory group list
rauto inventory group show access --json
rauto inventory group upsert access --file ./group-access.json
rauto inventory group delete access

Group JSON shape

{
  "name": "access",
  "description": "Campus access switches",
  "hosts": ["edge-sw-01", "edge-sw-02"]
}

The positional group name passed to group upsert is authoritative if JSON content also contains a name field.

Automatic discovery

rauto device discover 192.168.60.0/24 --credential network-admin
rauto device discover list --status identified
rauto device discover save --profile cisco_ios

Discovery accepts IPs, CIDRs, and ranges, tries up to three ordered probe credentials, persists the latest result, and prevents duplicate endpoint imports. Continue with Automatic Device Discovery for filters, TUI behavior, and Web usage.

Labels, groups, and enterprise inventory usage

The README describes saved connections as the source of truth for fields including:

  • enabled
  • labels
  • groups

This makes saved connections suitable for:

  • environment segmentation
  • region / site grouping
  • role-based grouping
  • staged orchestration targeting
  • approval-friendly naming and reporting

Enterprise operating model

Stage 1: ad-hoc execution

Use direct flags while learning.

Stage 2: saved connection normalization

Standardize names, device profiles, and SSH security settings.

Stage 3: group-based inventory

Define groups such as:

  • core
  • access
  • edge
  • linux-app
  • linux-jump

Stage 4: orchestration and workflow reuse

Build rollout logic on top of saved connections and groups rather than inline host fields.

Naming recommendations

Use stable names that work well in session records and orchestration plans.

Examples:

  • core-sh-01
  • access-bj-07
  • fw-hq-01
  • linux-jump-01