bolt

package module
v0.0.0-...-fc71d3c Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

bolt — go-puppet-bolt

License Go Coverage CGO

A pragmatic, pure-Go (CGO=0) port of the core of Puppet Bolt — the agentless orchestrator. It parses Bolt inventory, tasks and plans, and runs them through a pluggable transport, with no Ruby runtime and no cgo, so it cross-compiles to every 64-bit Go target and links into a static binary.

Non-stdlib dependencies are all pure Go: github.com/go-ruby-yaml/yaml (inventory / plan YAML), golang.org/x/crypto/ssh (the SSH transport), github.com/Azure/go-ntlmssp (WinRM NTLM negotiate) and github.com/go-puppet/puppet (the .pp plan evaluator and catalog compiler).

What it does

  • Inventory (inventory.yaml v2) — targets, nested groups, per-group and per-target config / facts / vars / features, target uri / name / alias, effective-value resolution through the group hierarchy (deep merge, closest group wins, target overrides all), and target selection by name, alias, group or glob (TargetsForQuery).
  • Tasks — parses the Bolt task *.json metadata shape (typed parameters with type / description / sensitive / default, input_method, supports_noop, implementations, files) and validates arguments against the declared parameter types (a pragmatic subset of the Puppet type system).
  • YAML plans (plan.yaml) — parameters and an ordered list of task / command / script / eval / plan / resources / message steps, with targets, per-step parameters, and a return expression.
  • Puppet-language (.pp) plans — plan name(...) { ... } manifests run through github.com/go-puppet/puppet; the run_task / run_command / run_script / get_targets / apply plan functions dispatch through this executor's transports and inventory to real targets (RunPuppetPlan).
  • Transports — a Transport interface with a host-local transport (LocalTransport) and a full SSH transport (SSHTransport, pure-Go over golang.org/x/crypto/ssh): key/password auth, host-key-check, run-as (sudo), tty, and upload-then-run for scripts and tasks, honouring config.ssh.
  • apply blocks & resources steps — the manifest is compiled to a catalog via go-puppet/puppet and an apply ResultSet is produced (ApplyCatalog).
  • Execution — an Executor runs a command, script or task across a set of targets, collecting a per-target Result into a ResultSet.

Boundaries (documented, not silently capped)

Area Status
SSH transport Done. Pure-Go over x/crypto/ssh; tested end-to-end against an in-process SSH server (auth, exec, upload, run-as, exit codes).
WinRM transport Done. Pure-Go WS-Management / MS-WSMV (SOAP over net/http) with basic, negotiate (NTLM via github.com/Azure/go-ntlmssp) and ssl (TLS client certificate) auth; RunCommand / RunScript / RunTask (stdin / environment / powershell / both input methods) / Upload, honouring config.winrm. Tested end-to-end against an in-process WS-Man server (shell create/command/send/receive/signal/delete, auth, faults, non-zero exit). Kerberos/CredSSP not implemented.
apply execution Compile + report. ApplyCatalog compiles the catalog and reports the resources it would enforce per target; it does not remotely enforce resources (that needs a Puppet agent — Bolt's apply_prep model — out of scope for the agentless core).
PuppetDB / _plugin inventory references Not implemented.
Full pcore type parser Basic type checks only (String/Integer/Float/Numeric/Boolean/Array/Hash/Optional/Enum/Pattern/Variant/…).

Example

inv, _ := bolt.ParseInventory(invBytes)
targets, _ := bolt.TargetsForQuery(inv, "web,db1.example.com")

exec := &bolt.Executor{
    Transport: bolt.NewLocalTransport(),
    Inventory: inv,
}
rs := exec.RunCommand(targets, "uptime")
fmt.Println(rs.Ok(), rs.Names())

Over SSH, running a Puppet-language plan:

exec := &bolt.Executor{
    Transport:  bolt.NewSSHTransport(),
    Inventory:  inv,
    TaskLoader: loadTask, // resolve a task by name
}
src := `plan deploy(TargetSpec $nodes) {
  run_command('systemctl stop app', $nodes)
  run_task('app::deploy', $nodes, {'version' => '1.2.3'})
  return apply($nodes) {
    service { 'app': ensure => running, enable => true }
  }
}`
res, err := exec.RunPuppetPlan(src, "deploy", map[string]any{"nodes": "web"})

Tests & coverage

Pure Go, stdlib test tooling, deterministic (no real processes, no network):

go test -race -coverprofile=cover.out ./...
go tool cover -func=cover.out   # 100.0%

CI builds and tests on all six 64-bit arches (amd64, arm64, riscv64, loong64, ppc64le, s390x).

License

BSD-3-Clause © the go-puppet-bolt/bolt authors.

Documentation

Overview

Package bolt is a pragmatic, pure-Go (cgo-free) port of the core of Puppet Bolt — the agentless orchestrator — covering the pieces that are fully deterministic and stdlib-expressible:

  • Inventory (inventory.yaml v2): targets, nested groups, per-group and per-target config / facts / vars / features, target uri / name / alias, effective-value resolution through the group hierarchy, and target selection by name, alias, group or glob (Inventory, Group, Target).
  • Tasks: task metadata (the Bolt task *.json shape — typed parameters, input_method, supports_noop, implementations, files) plus validation of a set of arguments against the declared parameter types (Task, TaskMetadata, TaskParameter).
  • Plans: YAML plans (plan.yaml — parameters and an ordered list of task / command / script / eval / plan / resources / message steps, targets and a return expression), parsed and executed by a step runner (YAMLPlan, Step, Executor.RunYAMLPlan); and Puppet-language (.pp) plans, run through github.com/go-puppet/puppet with the run_task / run_command / run_script / get_targets / apply plan functions dispatched to real targets (Executor.RunPuppetPlan).
  • Transports (Transport): a host-local transport (LocalTransport) driven through an injectable CommandRunner seam; a full SSH transport (SSHTransport, pure-Go over golang.org/x/crypto/ssh) that honours the target's config.ssh (user, port, key/password auth, host-key-check, run-as/sudo, tty, tmpdir) and uploads-then-runs scripts and tasks; and a full WinRM transport (WinRMTransport, pure-Go WS-Management/MS-WSMV over net/http with basic, NTLM-negotiate and TLS-client-certificate auth) that honours config.winrm and uploads-then-runs scripts and tasks on Windows.
  • apply blocks and the YAML `resources` step: the manifest is compiled to a catalog via github.com/go-puppet/puppet and an apply ResultSet is produced (Executor.ApplyCatalog).
  • An executor that runs a command, script or task across a set of targets, collecting a per-target Result into a ResultSet.

Scope and boundaries

The following are honestly bounded rather than silently capped:

  • apply execution: Executor.ApplyCatalog compiles the catalog and reports what would be enforced (resource references and count) per target. It does not remotely enforce resources — real enforcement needs a Puppet agent on the target (Bolt's apply_prep model), which is out of scope for the agentless core.
  • WinRM Kerberos/CredSSP authentication: only basic, NTLM-negotiate and TLS-client-certificate auth are implemented (transport "basic", "negotiate" and "ssl"). Kerberos ("realm") is rejected with a clear error.
  • PuppetDB and other plugin resolvers (`_plugin` inventory references).

Everything here is pure Go with no cgo, so it cross-compiles to and runs on every 64-bit Go target and links into a static binary by default. Non-stdlib dependencies are all pure Go: github.com/go-ruby-yaml/yaml (inventory/plan YAML), golang.org/x/crypto/ssh (the ssh transport), github.com/Azure/go-ntlmssp (WinRM NTLM negotiate) and github.com/go-puppet/puppet (the .pp plan evaluator and catalog compiler).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner interface {
	Run(name string, args []string, stdin string) (stdout, stderr string, exitCode int, err error)
}

CommandRunner is the seam through which LocalTransport executes processes. The default implementation (OSRunner) uses os/exec; tests inject a fake so no real process runs. stdin is fed to the process; the returned exit code is the process exit status (non-zero is not an error — err is only for failures to start or run the process).

type Executor

type Executor struct {
	Transport Transport
	Inventory *Inventory
	// TaskLoader resolves a task-step's task by name. Required to run task steps.
	TaskLoader func(name string) (*Task, error)
	// PlanLoader resolves a plan-step's sub-plan by name. Required to run plan
	// steps.
	PlanLoader func(name string) (*YAMLPlan, error)
}

Executor runs actions on targets through a Transport and executes YAML plans. Inventory (optional) resolves plan target-specs into Target values; TaskLoader and PlanLoader resolve the task and sub-plan steps of a plan.

func (*Executor) ApplyCatalog

func (e *Executor) ApplyCatalog(targets []*Target, cat *catalog.Catalog) ResultSet

ApplyCatalog applies cat to each target and returns a per-target ResultSet.

Execution boundary: this pure-Go port compiles the catalog (done by github.com/go-puppet/puppet before this point) and produces an apply result describing what would be enforced — the resource references and count — for each target. It does not remotely enforce resources: real enforcement needs a Puppet agent on the target (Bolt's apply_prep model), which is out of scope for the agentless core. The ResultSet is Ok when the catalog is non-empty.

func (*Executor) RunCommand

func (e *Executor) RunCommand(targets []*Target, command string) ResultSet

RunCommand runs command on every target, collecting a ResultSet.

func (*Executor) RunPuppetPlan

func (e *Executor) RunPuppetPlan(src, planName string, params map[string]any) (PlanResult, error)

RunPuppetPlan runs a Puppet-language (.pp) plan. src is the plan source (`plan name(...) { ... }`); planName is the fully-qualified plan to invoke; params are its arguments. The plan's run_task / run_command / run_script / get_targets / apply functions are dispatched through this executor's Transport and Inventory against real targets, so a `.pp` plan orchestrates exactly like a YAML plan does.

It returns the plan's return value plus any messages logged by notice()/ warning()/… during the run. Task steps require a Executor.TaskLoader; a plan that calls run_task without one fails with a descriptive error.

func (*Executor) RunScript

func (e *Executor) RunScript(targets []*Target, path string, args []string) ResultSet

RunScript runs the script at path with args on every target.

func (*Executor) RunTask

func (e *Executor) RunTask(targets []*Target, task *Task, params map[string]any) (ResultSet, error)

RunTask validates params against the task's declared parameters, then runs the task on every target. A validation error is returned before anything runs.

func (*Executor) RunYAMLPlan

func (e *Executor) RunYAMLPlan(p *YAMLPlan, params map[string]any) (PlanResult, error)

RunYAMLPlan executes a parsed YAML plan with the given arguments. It binds parameters (applying defaults and type-checking), runs each step in order, binds each named step's result into the plan scope, and returns the resolved `return` expression plus any message-step output.

type FileCopier

type FileCopier interface {
	Copy(src, dst string) error
}

FileCopier is the seam through which LocalTransport.Upload copies files. The default (OSFileCopier) uses the filesystem.

type Group

type Group struct {
	Name     string
	Targets  []*Target
	Groups   []*Group
	Config   map[string]any
	Facts    map[string]any
	Vars     map[string]any
	Features []string
	// contains filtered or unexported fields
}

Group is a named collection of targets and nested subgroups, carrying config, facts, vars and features inherited by the targets beneath it.

type Implementation

type Implementation struct {
	Name         string
	Requirements []string
	InputMethod  string
	Files        []string
}

Implementation is one platform-specific implementation of a task.

type Inventory

type Inventory struct {
	Version int
	// Root is the implicit top-level "all" group holding the inventory's
	// top-level targets, groups, config, facts, vars and features.
	Root *Group
	// contains filtered or unexported fields
}

Inventory is a parsed Bolt inventory (inventory.yaml v2): a tree of groups rooted at a synthetic "all" group, plus a registry of the targets they reference. Targets are deduplicated by name across the whole inventory, so a target listed in several groups is a single Target linked to each.

func ParseInventory

func ParseInventory(src []byte) (*Inventory, error)

ParseInventory parses an inventory.yaml v2 document.

func (*Inventory) GetOrCreateTarget

func (inv *Inventory) GetOrCreateTarget(spec string) *Target

GetOrCreateTarget resolves a target by name/alias/uri, registering an ad-hoc target (attached to no group) when none exists. It is how a plan turns a bare target-spec string into a Target.

func (*Inventory) Group

func (inv *Inventory) Group(name string) (*Group, bool)

Group finds a group by name anywhere in the tree (depth-first, "all" included).

func (*Inventory) GroupTargets

func (inv *Inventory) GroupTargets(name string) ([]*Target, error)

GroupTargets returns every target in the named group, including those in its subgroups, deduplicated in first-seen order.

func (*Inventory) Target

func (inv *Inventory) Target(key string) (*Target, bool)

Target resolves a single target by name, alias or uri.

func (*Inventory) Targets

func (inv *Inventory) Targets() []*Target

Targets returns every registered target in declaration order.

type LocalTransport

type LocalTransport struct {
	Runner CommandRunner
	Copier FileCopier
	// Shell is the shell used for command steps; defaults to "sh -c".
	Shell     string
	ShellFlag string
}

LocalTransport runs actions on the host itself. It drives a CommandRunner and a FileCopier so behaviour is deterministic and injectable in tests.

func NewLocalTransport

func NewLocalTransport() *LocalTransport

NewLocalTransport returns a LocalTransport using the OS runner and copier.

func (*LocalTransport) RunCommand

func (l *LocalTransport) RunCommand(target *Target, command string) Result

RunCommand runs command through the configured shell.

func (*LocalTransport) RunScript

func (l *LocalTransport) RunScript(target *Target, scriptPath string, args []string) Result

RunScript runs the script at scriptPath with args.

func (*LocalTransport) RunTask

func (l *LocalTransport) RunTask(target *Target, task *Task, params map[string]any) Result

RunTask runs task with params. Parameters are passed by the task's input method: "environment" exports each parameter as PT_<name>; anything else (the default "stdin"/"both") feeds a JSON object on stdin.

func (*LocalTransport) Upload

func (l *LocalTransport) Upload(target *Target, src, dst string) Result

Upload copies src to dst on the host.

type OSFileCopier

type OSFileCopier struct{}

OSFileCopier is the default FileCopier; it copies via the filesystem.

func (OSFileCopier) Copy

func (OSFileCopier) Copy(src, dst string) error

Copy copies the file at src to dst.

type OSRunner

type OSRunner struct{}

OSRunner is the default CommandRunner; it shells out through os/exec.

func (OSRunner) Run

func (OSRunner) Run(name string, args []string, stdin string) (string, string, int, error)

Run executes name with args, feeding stdin, and returns captured output.

type PlanParameter

type PlanParameter struct {
	Type        string
	Description string
	Default     any
	HasDefault  bool
}

PlanParameter describes one declared plan parameter.

type PlanResult

type PlanResult struct {
	Value    any
	Messages []string
}

PlanResult is the outcome of running a plan: its return value plus any messages emitted by message steps.

type Result

type Result struct {
	Target string
	Action string // "command" | "script" | "task" | "upload"
	Object string // the command line, script path or task name
	Value  map[string]any
	Err    error
}

Result is the outcome of one action (command, script, task or upload) on one target, mirroring Bolt's Result. Value holds the structured output (stdout / stderr / exit_code for a command, or the task's own JSON output); Err is set when the action could not run at all (e.g. the transport failed) as opposed to running and exiting non-zero.

func (Result) Error

func (r Result) Error() error

Error returns the transport error, if any.

func (Result) ExitCode

func (r Result) ExitCode() (int, bool)

ExitCode returns the action's exit code and whether one was recorded.

func (Result) Ok

func (r Result) Ok() bool

Ok reports whether the action ran and succeeded: no transport error and, when an exit code is present, a zero exit code.

type ResultSet

type ResultSet struct {
	// contains filtered or unexported fields
}

ResultSet aggregates the per-target Result values of running one action across several targets.

func NewResultSet

func NewResultSet(results ...Result) ResultSet

NewResultSet builds a ResultSet from results.

func (ResultSet) Count

func (rs ResultSet) Count() int

Count returns the number of results.

func (ResultSet) Empty

func (rs ResultSet) Empty() bool

Empty reports whether the set has no results.

func (ResultSet) ErrorSet

func (rs ResultSet) ErrorSet() ResultSet

ErrorSet returns the subset of results that failed.

func (ResultSet) Find

func (rs ResultSet) Find(target string) (Result, bool)

Find returns the result for the named target and whether it was present.

func (ResultSet) Names

func (rs ResultSet) Names() []string

Names returns the target names in the set, in order.

func (ResultSet) Ok

func (rs ResultSet) Ok() bool

Ok reports whether every result in the set succeeded. An empty set is Ok.

func (ResultSet) OkSet

func (rs ResultSet) OkSet() ResultSet

OkSet returns the subset of results that succeeded.

func (ResultSet) Results

func (rs ResultSet) Results() []Result

Results returns the underlying results in target order.

type SSHTransport

type SSHTransport struct {
	// Dialer establishes the transport-level connection. It defaults to a
	// net.Dialer honouring the target's connect-timeout. Tests inject a dialer
	// that reaches an in-process server (and can force connect failures).
	Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
	// KnownHostsFile is consulted when a target enables host-key-check. Empty
	// means host-key-check requires an explicit known-hosts path in config.
	KnownHostsFile string
}

SSHTransport runs actions on a target over SSH, mirroring Bolt's ssh transport. It honours the target's effective `config.ssh` block (user, port, private-key/password, host-key-check, run-as/sudo, tty, tmpdir, connect timeout) and implements the full Transport surface:

  • RunCommand runs a command through the login shell.
  • RunScript uploads the script to a remote temp dir, makes it executable, runs it with arguments, then removes it.
  • RunTask uploads the task executable, feeds parameters by the task's input_method (stdin JSON, PT_-prefixed environment, PowerShell, or both), runs it, then removes it.
  • Upload copies a local file to a destination via a stdin-streamed write.

The connection itself (dial, auth, host-key verification, exec/upload wire protocol, sudo/su/doas escalation) is github.com/go-remoteexec/transport, shared with go-ansible; this file only resolves Bolt's own config shape and layers Bolt's task-input-method conventions on top.

func NewSSHTransport

func NewSSHTransport() *SSHTransport

NewSSHTransport returns an SSHTransport using a real TCP dialer.

func (*SSHTransport) RunCommand

func (s *SSHTransport) RunCommand(target *Target, command string) Result

RunCommand runs command on the target through its login shell.

func (*SSHTransport) RunScript

func (s *SSHTransport) RunScript(target *Target, scriptPath string, args []string) Result

RunScript uploads the script to the remote temp dir, executes it with args, and removes it afterwards.

func (*SSHTransport) RunTask

func (s *SSHTransport) RunTask(target *Target, task *Task, params map[string]any) Result

RunTask uploads the task executable, feeds it parameters by its input method, runs it, then removes it. A JSON object printed on stdout is merged into the result (matching Bolt and LocalTransport.RunTask).

func (*SSHTransport) Upload

func (s *SSHTransport) Upload(target *Target, src, dst string) Result

Upload copies the local file at src to dst on the target.

type Step

type Step struct {
	Name    string
	Kind    StepKind
	Targets any // string, []string, or "$var" — resolved at run time

	Task       string         // Kind == StepTask
	Command    string         // Kind == StepCommand
	Script     string         // Kind == StepScript
	Plan       string         // Kind == StepPlan
	Message    any            // Kind == StepMessage
	Eval       any            // Kind == StepEval
	Parameters map[string]any // task/plan parameters
	Arguments  []any          // script arguments
	Resources  []any          // Kind == StepResources
}

Step is one step of a YAML plan. Only the fields relevant to Kind are set.

type StepKind

type StepKind string

StepKind identifies the action a plan step performs.

const (
	StepTask      StepKind = "task"
	StepCommand   StepKind = "command"
	StepScript    StepKind = "script"
	StepEval      StepKind = "eval"
	StepPlan      StepKind = "plan"
	StepResources StepKind = "resources"
	StepMessage   StepKind = "message"
)

The supported YAML-plan step kinds.

type Target

type Target struct {
	Name     string
	URI      string
	Aliases  []string
	Config   map[string]any
	Facts    map[string]any
	Vars     map[string]any
	Features []string
	// contains filtered or unexported fields
}

Target is a single node the orchestrator can act on. Config, Facts, Vars and Features hold the target's own declared data; the Effective* methods resolve the values seen after group inheritance.

func TargetsForQuery

func TargetsForQuery(inv *Inventory, query string) ([]*Target, error)

TargetsForQuery resolves a Bolt-style target query: a comma-separated list of group names, target names/aliases/uris, or globs (matched against target names with path.Match). Results are deduplicated in first-seen order.

func (*Target) EffectiveConfig

func (t *Target) EffectiveConfig() map[string]any

EffectiveConfig resolves the target's config after group inheritance: group data merged from least- to most-specific (deep merge of nested mappings), then the target's own config on top.

func (*Target) EffectiveFacts

func (t *Target) EffectiveFacts() map[string]any

EffectiveFacts resolves the target's facts after group inheritance.

func (*Target) EffectiveFeatures

func (t *Target) EffectiveFeatures() []string

EffectiveFeatures resolves the union of the target's own features and those of every group affecting it, in first-seen order.

func (*Target) EffectiveVars

func (t *Target) EffectiveVars() map[string]any

EffectiveVars resolves the target's vars after group inheritance.

type Task

type Task struct {
	// Name is the task's fully-qualified name (e.g. "package" or "mymod::run").
	Name string
	// File is the path to the executable this task runs (the implementation
	// selected for the local platform). Empty means the task carries metadata
	// only.
	File string
	// Metadata is the parsed *.json metadata; nil if the task has none.
	Metadata *TaskMetadata
}

Task is a Bolt task: a named executable file plus optional metadata declaring its parameters, input method and implementations.

func (*Task) ValidateParams

func (t *Task) ValidateParams(params map[string]any) error

ValidateParams checks a set of task arguments against the task's declared parameters: it rejects unknown parameters, reports missing required ones (declared, without a default), and type-checks provided values. A task without metadata (or without a parameters block) accepts any arguments.

type TaskMetadata

type TaskMetadata struct {
	Description     string
	Parameters      map[string]TaskParameter
	InputMethod     string
	SupportsNoop    bool
	Implementations []Implementation
	Files           []string
}

TaskMetadata is the parsed content of a task's *.json metadata file.

func ParseTaskMetadata

func ParseTaskMetadata(src []byte) (*TaskMetadata, error)

ParseTaskMetadata parses a task's *.json metadata.

func (*TaskMetadata) ParameterNames

func (md *TaskMetadata) ParameterNames() []string

ParameterNames returns the declared parameter names in sorted order.

type TaskParameter

type TaskParameter struct {
	Type        string
	Description string
	Sensitive   bool
	Default     any
	HasDefault  bool
}

TaskParameter describes one declared task parameter.

type Transport

type Transport interface {
	// RunCommand runs a shell command on the target.
	RunCommand(target *Target, command string) Result
	// RunScript uploads and runs a script with arguments on the target.
	RunScript(target *Target, scriptPath string, args []string) Result
	// RunTask runs a task with parameters on the target.
	RunTask(target *Target, task *Task, params map[string]any) Result
	// Upload copies a local file/directory to a destination on the target.
	Upload(target *Target, src, dst string) Result
}

Transport runs actions on a target. It is implemented by LocalTransport, SSHTransport and WinRMTransport; the interface is the extension point for any further transport.

type WinRMTransport

type WinRMTransport struct {
	// NewDoer builds the HTTP client used to reach a target. Defaults to
	// the shared transport's own client. Tests inject a doer that reaches
	// an in-process WS-Man server (and can force connect/auth failures).
	NewDoer func(remoteexec.WinRMConfig) (remoteexec.HTTPDoer, error)
}

WinRMTransport runs actions on a Windows target over WinRM, mirroring Bolt's winrm transport. It honours the target's effective config.winrm block (host, port, user, password, ssl, ssl-verify, cacert, transport, realm, cert/key, tmpdir, connect-timeout, path) and implements the full Transport surface:

  • RunCommand runs a command line through the remote shell.
  • RunScript uploads the script to a remote temp dir, runs it (PowerShell for .ps1, directly otherwise) with arguments, then removes it.
  • RunTask uploads the task executable, feeds parameters by the task's input_method (stdin JSON, PT_-prefixed shell environment, PowerShell named arguments, or both), runs it, then removes it.
  • Upload writes a local file to a destination.

The connection itself (WS-Management wire protocol, NTLM/basic/TLS-client-cert auth) is github.com/go-remoteexec/transport, shared with go-ansible; this file only resolves Bolt's own config shape and layers Bolt's task-input-method conventions on top.

func NewWinRMTransport

func NewWinRMTransport() *WinRMTransport

NewWinRMTransport returns a WinRMTransport using the default HTTP client.

func (*WinRMTransport) RunCommand

func (t *WinRMTransport) RunCommand(target *Target, command string) Result

RunCommand runs command on the target through the remote shell.

func (*WinRMTransport) RunScript

func (t *WinRMTransport) RunScript(target *Target, scriptPath string, args []string) Result

RunScript uploads the script to the remote temp dir, runs it with args, and removes it afterwards.

func (*WinRMTransport) RunTask

func (t *WinRMTransport) RunTask(target *Target, task *Task, params map[string]any) Result

RunTask uploads the task executable, feeds it parameters by its input method, runs it, then removes it. A JSON object printed on stdout is merged into the result (matching Bolt and the other transports).

func (*WinRMTransport) Upload

func (t *WinRMTransport) Upload(target *Target, src, dst string) Result

Upload copies the local file at src to dst on the target.

type YAMLPlan

type YAMLPlan struct {
	Description string
	Parameters  map[string]PlanParameter
	ParamOrder  []string
	Steps       []Step
	// Return is the plan's return expression (a literal or a "$var" reference),
	// or nil when the plan has no return key.
	Return    any
	HasReturn bool
}

YAMLPlan is a parsed Bolt YAML plan (plan.yaml).

func ParsePlan

func ParsePlan(src []byte) (*YAMLPlan, error)

ParsePlan parses a plan.yaml document.

Jump to

Keyboard shortcuts

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