Documentation
¶
Index ¶
- Constants
- func NormalizeInventoryFormat(format string) string
- func NormalizeInventorySource(source string) string
- func NormalizeInventoryStyle(style string) string
- func SaveInventory(path, content string) error
- type AdhocOptions
- type CommandResult
- type CommunityProxmoxOptions
- type InventoryDefaults
- type InventoryHost
- type InventoryResult
- func BuildCommunityProxmoxInventory(opts CommunityProxmoxOptions) (InventoryResult, error)
- func BuildInventory(nodes []*api.Node, guests []*api.VM, defaults InventoryDefaults) InventoryResult
- func BuildInventoryWithFormat(nodes []*api.Node, guests []*api.VM, defaults InventoryDefaults, format string) InventoryResult
- type OutputLineHandler
- type PlaybookOptions
- type Runner
- func (r *Runner) CheckAvailability() error
- func (r *Runner) CheckInventoryAvailability() error
- func (r *Runner) RunAdhoc(ctx context.Context, inventoryText, inventoryFormat string, opts AdhocOptions) CommandResult
- func (r *Runner) RunAdhocInventory(ctx context.Context, inventory InventoryResult, opts AdhocOptions, ...) CommandResult
- func (r *Runner) RunAdhocStream(ctx context.Context, inventoryText, inventoryFormat string, opts AdhocOptions, ...) CommandResult
- func (r *Runner) RunInventoryList(ctx context.Context, inventory InventoryResult) CommandResult
- 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) RunPlaybookInventory(ctx context.Context, inventory InventoryResult, opts PlaybookOptions, ...) CommandResult
- func (r *Runner) RunPlaybookStream(ctx context.Context, inventoryText, inventoryFormat string, ...) CommandResult
- func (r *Runner) SetEnv(env map[string]string)
Constants ¶
const ( InventoryFormatINI = "ini" InventoryFormatYAML = "yaml" InventorySourcePvetui = "pvetui" InventorySourceProxmox = "community_proxmox" InventoryStyleCompact = "compact" InventoryStyleExpanded = "expanded" )
Variables ¶
This section is empty.
Functions ¶
func NormalizeInventoryFormat ¶
NormalizeInventoryFormat validates and canonicalizes inventory format.
func NormalizeInventorySource ¶ added in v1.4.1
NormalizeInventorySource validates and canonicalizes an inventory source.
func NormalizeInventoryStyle ¶
NormalizeInventoryStyle validates and canonicalizes inventory style.
func SaveInventory ¶
SaveInventory writes inventory text to a user-selected path.
Types ¶
type AdhocOptions ¶ added in v1.3.2
type AdhocOptions struct {
Pattern string
Module string
ModuleArgs string
Limit string
ExtraArgs []string
}
AdhocOptions describes ansible ad-hoc module invocation options.
type CommandResult ¶
CommandResult stores process execution details.
type CommunityProxmoxOptions ¶ added in v1.4.1
type CommunityProxmoxOptions struct {
URL string
User string
TokenID string
Password string
TokenSecret string
NodeSSHUser string
VMSSHUser string
SSHPrivateKeyFile string
DefaultPassword string
InventoryVars map[string]string
ValidateCerts bool
WantFacts bool
WantPostFilterFacts bool
WantProxmoxNodesAnsibleHost *bool
ExcludeNodes bool
Filters []string
Compose map[string]string
Groups map[string]string
KeyedGroups []map[string]string
}
CommunityProxmoxOptions describes a generated community.proxmox.proxmox dynamic inventory source.
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 {
Source string
Format string
Text string
Hosts []InventoryHost
Env map[string]string
}
InventoryResult contains the final inventory text and generated host metadata.
func BuildCommunityProxmoxInventory ¶ added in v1.4.1
func BuildCommunityProxmoxInventory(opts CommunityProxmoxOptions) (InventoryResult, error)
BuildCommunityProxmoxInventory renders an Ansible dynamic inventory source for the community.proxmox.proxmox collection. Non-secret connection values are written to the source so it can be reused outside pvetui; secrets are returned as environment variables so they are not written to disk.
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 {
// contains filtered or unexported fields
}
Runner executes local ansible commands.
func (*Runner) CheckAvailability ¶
CheckAvailability verifies that required ansible binaries are available in PATH.
func (*Runner) CheckInventoryAvailability ¶ added in v1.4.1
CheckInventoryAvailability verifies that ansible-inventory is available.
func (*Runner) RunAdhoc ¶ added in v1.3.2
func (r *Runner) RunAdhoc(ctx context.Context, inventoryText, inventoryFormat string, opts AdhocOptions) CommandResult
RunAdhoc executes ansible ad-hoc commands with a generated temporary inventory.
func (*Runner) RunAdhocInventory ¶ added in v1.4.1
func (r *Runner) RunAdhocInventory( ctx context.Context, inventory InventoryResult, opts AdhocOptions, handler OutputLineHandler, ) CommandResult
RunAdhocInventory executes ansible ad-hoc commands with an inventory source.
func (*Runner) RunAdhocStream ¶ added in v1.3.2
func (r *Runner) RunAdhocStream( ctx context.Context, inventoryText, inventoryFormat string, opts AdhocOptions, handler OutputLineHandler, ) CommandResult
RunAdhocStream executes ansible ad-hoc commands and streams output lines when handler is provided.
func (*Runner) RunInventoryList ¶ added in v1.4.1
func (r *Runner) RunInventoryList(ctx context.Context, inventory InventoryResult) CommandResult
RunInventoryList resolves an inventory source with ansible-inventory --list.
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) RunPlaybookInventory ¶ added in v1.4.1
func (r *Runner) RunPlaybookInventory( ctx context.Context, inventory InventoryResult, opts PlaybookOptions, handler OutputLineHandler, ) CommandResult
RunPlaybookInventory executes ansible-playbook with an inventory source.
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.