Inventory from a SDK¶
The inventory helpers live in each SDK’s OOB module. They read the lab directory and the exporter files. They do not call the agent, and they do not start OOB.
Prepare OOB with that same SDK first, so ssh_config and ansible_paramiko_proxy_command name the same proxy. The CLI page is Inventory export. This page is the three function calls.
render_project, renderProject, and RenderInventory return the text, the host names in catalogue order, and the ssh_config path. You write the file. The CLI and Generate Inventory write <project>/.eve-iac/inventory/ plus the filename from the registry (inventory.ansible.yml, inventory.netmiko.yml).
If ssh_config is missing, the call fails with oob_not_prepared.
Python¶
render_project defaults to this interpreter and eveiac.oob.proxy. Pass entrypoint only to replace that.
from eveiac.oob.inventory import render_project
rendered = render_project("IaC/sample", "ansible")
print(rendered.target)
print(rendered.hosts)
print(rendered.ssh_config)
open("inventory.ansible.yml", "w", encoding="utf-8").write(rendered.text)
load_registry() is the same table eve-iac inventory targets prints. rendered.text is the YAML. The private key and session_token are not in it.
TypeScript¶
renderProject defaults to typescriptProxyEntrypoint() (process.execPath and proxy.js). The IDE passes node plus that script when the host is Electron, Cursor, code, or code-tunnel.
import * as fs from "node:fs";
import { renderProject } from "@eve-iac/sdk";
const rendered = renderProject("IaC/sample", "ansible");
console.log(rendered.target, rendered.hosts, rendered.ssh_config);
fs.writeFileSync("inventory.ansible.yml", rendered.text);
loadRegistry() returns the exporters. An unknown target throws InventoryError with code unknown_target.
Go¶
Go does not look up a binary. Pass the same slice you passed to MaterializeOOB. An empty slice is rejected.
ProxyCommand is one executable path. A proxy that is itself an interpreter plus arguments is the full slice, the same way the CLI uses Python and -m.
rendered, err := eveiac.RenderInventory(
project,
"ansible",
eveiac.ProxyCommand(os.Getenv("HOME")+"/bin/eve-iac-oob-proxy"),
)
if err != nil {
panic(err)
}
fmt.Println(rendered.Target)
fmt.Println(rendered.Hosts)
fmt.Println(rendered.SSHConfig)
if err := os.WriteFile("inventory.ansible.yml", []byte(rendered.Text), 0o644); err != nil {
panic(err)
}
LoadInventoryRegistry("") reads the packaged registry. reg.Order is the target names.