module

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Registry

func Registry() target.ModuleRegistry

Registry returns a map of all built-in module names to their implementations.

Types

type DirectoryModule

type DirectoryModule struct{}

DirectoryModule manages a directory at a given path. Params:

  • path (required): directory path
  • ensure: "present" (default) or "absent"
  • owner: (future) directory owner
  • permissions: (future) directory permissions

func (*DirectoryModule) Apply

func (m *DirectoryModule) Apply(_ context.Context, params map[string]any) error

func (*DirectoryModule) Check

func (m *DirectoryModule) Check(_ context.Context, params map[string]any) (bool, error)

type EnvironmentModule

type EnvironmentModule struct{}

EnvironmentModule manages environment variables. Params:

  • name (required): variable name
  • value (required for ensure=present): variable value
  • scope: "user" (default) or "machine"
  • ensure: "present" (default) or "absent"

Note: os.Setenv affects the current process. Machine-scope persistence on Windows requires registry writes (handled in environment_windows.go).

func (*EnvironmentModule) Apply

func (m *EnvironmentModule) Apply(_ context.Context, params map[string]any) error

func (*EnvironmentModule) Check

func (m *EnvironmentModule) Check(_ context.Context, params map[string]any) (bool, error)

type FileModule

type FileModule struct{}

FileModule manages a file at a destination path. Params:

  • dest (required): destination path
  • src: source path to copy from
  • ensure: "present" (default) or "absent"
  • owner: (future) file owner
  • permissions: (future) file permissions

func (*FileModule) Apply

func (m *FileModule) Apply(_ context.Context, params map[string]any) error

func (*FileModule) Check

func (m *FileModule) Check(_ context.Context, params map[string]any) (bool, error)

type PowershellModule

type PowershellModule struct{}

PowershellModule runs PowerShell scripts or files. On non-Windows platforms, attempts to exec `powershell` (WSL/cross-platform compat). Params:

  • script: inline PowerShell script string
  • file: path to a .ps1 file
  • args: list of additional arguments (used with file)
  • creates: path that indicates the operation is already done

func (*PowershellModule) Apply

func (m *PowershellModule) Apply(_ context.Context, params map[string]any) error

func (*PowershellModule) Check

func (m *PowershellModule) Check(_ context.Context, params map[string]any) (bool, error)

type RebootModule

type RebootModule struct{}

RebootModule triggers or checks for a pending system reboot. Params:

  • condition: "always" (default) or "if_needed"
  • timeout: seconds before reboot (default 60, Windows only)

func (*RebootModule) Apply

func (m *RebootModule) Apply(_ context.Context, params map[string]any) error

func (*RebootModule) Check

func (m *RebootModule) Check(_ context.Context, params map[string]any) (bool, error)

type ShellModule

type ShellModule struct{}

ShellModule runs an arbitrary shell command. Params:

  • cmd (required): command to execute
  • args: list of arguments
  • creates: path; if it exists, skip execution
  • working_dir: working directory for the command

func (*ShellModule) Apply

func (m *ShellModule) Apply(_ context.Context, params map[string]any) error

func (*ShellModule) Check

func (m *ShellModule) Check(_ context.Context, params map[string]any) (bool, error)

type WaitModule

type WaitModule struct{}

WaitModule polls until a condition is met or a timeout expires. Params:

  • condition (required): "port_open", "file_exists", or "service_running"
  • target (required): address:port / path / service name depending on condition
  • timeout: duration string (default "5m")

func (*WaitModule) Apply

func (m *WaitModule) Apply(ctx context.Context, params map[string]any) error

func (*WaitModule) Check

func (m *WaitModule) Check(_ context.Context, params map[string]any) (bool, error)

Jump to

Keyboard shortcuts

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