executor

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tracer = otel.Tracer("mid/provider/executor")

Functions

func CallAgent added in v0.0.5

func CallAgent[I any, O any](ctx context.Context, a *agent.Agent, call rpc.RPCCall[I]) (rpc.RPCResult[O], error)

func CanConnect added in v0.0.5

func CanConnect(ctx context.Context, connection *types.Connection, maxAttempts int) (bool, error)

func ConnectionToSSHClientConfig added in v0.0.5

func ConnectionToSSHClientConfig(connection *types.Connection) (*ssh.ClientConfig, string, error)

func DialWithRetry added in v0.0.5

func DialWithRetry[T any](ctx context.Context, msg string, maxAttempts int, f func() (T, error)) (T, error)

func GetTaskResult

func GetTaskResult[T any](playOutput PlayOutput, play int, task int) (T, error)

func RunPlaybook

func RunPlaybook(ctx context.Context, connection *types.Connection, playbook []byte) ([]byte, error)

func StartAgent added in v0.0.5

func StartAgent(ctx context.Context, connection *types.Connection) (*agent.Agent, error)

Types

type Play

type Play struct {
	GatherFacts bool
	Become      bool
	Check       bool
	Tasks       []any
}

type PlayOutput

type PlayOutput struct {
	CustomStats       map[string]any             `json:"custom_stats"`
	GlobalCustomStats map[string]any             `json:"global_custom_stats"`
	Results           []PlayOutputResult         `json:"plays"`
	Stats             map[string]PlayOutputStats `json:"stats"`
}

func RunPlay

func RunPlay(ctx context.Context, connection *types.Connection, plays ...Play) (PlayOutput, error)

type PlayOutputItemMetadata

type PlayOutputItemMetadata struct {
	Duration PlayOutputItemMetadataDuration `json:"duration"`
	Id       string                         `json:"id"`
	Name     string                         `json:"name"`
	Path     string                         `json:"path"`
}

type PlayOutputItemMetadataDuration

type PlayOutputItemMetadataDuration struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

type PlayOutputResult

type PlayOutputResult struct {
	Play  PlayOutputItemMetadata `json:"play"`
	Tasks []PlayOutputTask       `json:"tasks"`
}

type PlayOutputStats

type PlayOutputStats struct {
	Changed     uint `json:"changed"`
	Failures    uint `json:"failures"`
	Ignored     uint `json:"ignored"`
	Ok          uint `json:"ok"`
	Rescued     uint `json:"rescued"`
	Skipped     uint `json:"skipped"`
	Unreachable uint `json:"unreachable"`
}

type PlayOutputTask

type PlayOutputTask struct {
	Hosts map[string]any         `json:"hosts"`
	Task  PlayOutputItemMetadata `json:"task"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL