Help us shape the future of Go! Take the 2026 Go Developer Survey

executor

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnreachable = errors.New("host is unreachable")
)
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, connection *types.Connection, 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 DisconnectAll added in v0.0.6

func DisconnectAll(ctx context.Context) 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) (*midagent.Agent, error)

Types

type ConnectionState added in v0.0.6

type ConnectionState struct {
	ID         uint64
	Reachable  bool
	Mutex      sync.Mutex
	Agent      *midagent.Agent
	Connection *types.Connection
}

func Acquire added in v0.0.6

func Acquire(ctx context.Context, connection *types.Connection) (*ConnectionState, error)

func (*ConnectionState) SetupAgent added in v0.0.6

func (cs *ConnectionState) SetupAgent(ctx context.Context) error

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