Documentation
¶
Index ¶
- Constants
- func NormalizeInventoryFormat(format string) string
- func NormalizeInventoryStyle(style string) string
- func SaveInventory(path, content string) error
- type CommandResult
- type InventoryDefaults
- type InventoryHost
- type InventoryResult
- type OutputLineHandler
- type PlaybookOptions
- type Runner
- func (r *Runner) CheckAvailability() error
- func (r *Runner) RunPing(ctx context.Context, inventoryText, inventoryFormat, limit string, ...) CommandResult
- func (r *Runner) RunPingStream(ctx context.Context, inventoryText, inventoryFormat, limit string, ...) CommandResult
- func (r *Runner) RunPlaybook(ctx context.Context, inventoryText, inventoryFormat string, ...) CommandResult
- func (r *Runner) RunPlaybookStream(ctx context.Context, inventoryText, inventoryFormat string, ...) CommandResult
Constants ¶
const ( InventoryFormatINI = "ini" InventoryFormatYAML = "yaml" InventoryStyleCompact = "compact" InventoryStyleExpanded = "expanded" )
Variables ¶
This section is empty.
Functions ¶
func NormalizeInventoryFormat ¶
NormalizeInventoryFormat validates and canonicalizes inventory format.
func NormalizeInventoryStyle ¶
NormalizeInventoryStyle validates and canonicalizes inventory style.
func SaveInventory ¶
SaveInventory writes inventory text to a user-selected path.
Types ¶
type CommandResult ¶
CommandResult stores process execution details.
type InventoryDefaults ¶
type InventoryDefaults struct {
NodeSSHUser string
VMSSHUser string
SSHPrivateKeyFile string
DefaultPassword string
InventoryVars map[string]string
Style string
}
InventoryDefaults defines default SSH users for inventory generation.
type InventoryHost ¶
InventoryHost captures one generated host entry.
type InventoryResult ¶
type InventoryResult struct {
Format string
Text string
Hosts []InventoryHost
}
InventoryResult contains the final inventory text and generated host metadata.
func BuildInventory ¶
func BuildInventory(nodes []*api.Node, guests []*api.VM, defaults InventoryDefaults) InventoryResult
BuildInventory renders an INI-style Ansible inventory from Proxmox nodes and guests.
func BuildInventoryWithFormat ¶
func BuildInventoryWithFormat(nodes []*api.Node, guests []*api.VM, defaults InventoryDefaults, format string) InventoryResult
BuildInventoryWithFormat renders an inventory in the requested format.
type OutputLineHandler ¶
type OutputLineHandler func(line string)
OutputLineHandler receives a single line of command output.
type PlaybookOptions ¶
PlaybookOptions describes ansible-playbook invocation options.
type Runner ¶
type Runner struct{}
Runner executes local ansible commands.
func (*Runner) CheckAvailability ¶
CheckAvailability verifies that required ansible binaries are available in PATH.
func (*Runner) RunPing ¶
func (r *Runner) RunPing(ctx context.Context, inventoryText, inventoryFormat, limit string, extraArgs []string) CommandResult
RunPing executes `ansible -m ping` using the generated inventory.
func (*Runner) RunPingStream ¶
func (r *Runner) RunPingStream( ctx context.Context, inventoryText, inventoryFormat, limit string, extraArgs []string, handler OutputLineHandler, ) CommandResult
RunPingStream executes `ansible -m ping` and streams output lines when handler is provided.
func (*Runner) RunPlaybook ¶
func (r *Runner) RunPlaybook(ctx context.Context, inventoryText, inventoryFormat string, opts PlaybookOptions) CommandResult
RunPlaybook executes ansible-playbook with a generated temporary inventory.
func (*Runner) RunPlaybookStream ¶
func (r *Runner) RunPlaybookStream( ctx context.Context, inventoryText, inventoryFormat string, opts PlaybookOptions, handler OutputLineHandler, ) CommandResult
RunPlaybookStream executes ansible-playbook and streams output lines when handler is provided.