ork

package module
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

README

Ork

Ork Logo

Ork is a Go package for SSH-based server automation. Think of it like Ansible, but in Go - you define Nodes (remote servers), organize them into Groups, and run commands, skills, or playbooks against them individually or at scale via Inventory.

Installation

Library
go get github.com/dracory/ork
CLI Tool
go install github.com/dracory/ork/cmd/ork@latest

Or build from source:

git clone https://github.com/dracory/ork.git
cd ork
go build -o ork ./cmd/ork

Documentation

Full documentation is available in the docs directory.

Getting Started
Automation
Features
Reference

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). You can find a copy of the license at https://www.gnu.org/licenses/agpl-3.0.en.html

For commercial use, please use my contact page to obtain a commercial license.

Documentation

Overview

Package ork provides a framework for remote server automation.

Package ork provides a simple, intuitive API for SSH-based server automation.

The core concept is the Node - a representation of a remote server that you can connect to and run commands, skills, or playbooks against.

Basic usage:

node := ork.NewNode("server.example.com")
output, err := node.Run("uptime")

With configuration:

node := ork.NewNode("server.example.com").
    SetPort("2222").
    SetUser("deploy")
output, err := node.Run("uptime")

Persistent connections for multiple operations:

node := ork.NewNode("server.example.com")
if err := node.Connect(); err != nil {
    log.Fatal(err)
}
defer node.Close()

output1, _ := node.Run("uptime")
output2, _ := node.Run("df -h")

Running skills:

node := ork.NewNode("server.example.com").
    SetArg("username", "alice")
err := node.Run(skills.NewUserCreate())

Running commands on nodes/inventories (fluent interface):

command := ork.NewCommand().
    WithDescription("Restart application").
    WithCommand("pm2 restart app").
    WithRequired(true)

node := ork.NewNodeForHost("server.example.com")
result := node.Run(command)

inventory := ork.NewInventory()
result := inventory.Run(command)

For advanced use cases, the internal packages remain accessible:

  • ssh - SSH client
  • types - Shared types (RunnableInterface, Registry, Result, Command)
  • skills - Built-in skill implementations

Package ork provides a framework for remote server automation.

Index

Constants

View Source
const (
	// SkillPing checks SSH connectivity
	SkillPing = skills.IDPing

	// SkillAptUpdate refreshes the package database
	SkillAptUpdate = skills.IDAptUpdate

	// SkillAptUpgrade installs available updates
	SkillAptUpgrade = skills.IDAptUpgrade

	// SkillAptStatus shows available updates
	SkillAptStatus = skills.IDAptStatus

	// SkillReboot reboots the server
	SkillReboot = skills.IDReboot

	// SkillSwapCreate creates a swap file (requires "size" arg in GB)
	SkillSwapCreate = skills.IDSwapCreate

	// SkillSwapDelete removes the swap file
	SkillSwapDelete = skills.IDSwapDelete

	// SkillSwapStatus shows swap status
	SkillSwapStatus = skills.IDSwapStatus

	// SkillUserCreate creates a user with sudo (requires "username" arg)
	SkillUserCreate = skills.IDUserCreate

	// SkillUserDelete deletes a user (requires "username" arg)
	SkillUserDelete = skills.IDUserDelete

	// SkillUserList lists all non-system users
	SkillUserList = skills.IDUserList

	// SkillUserStatus shows user info (requires "username" arg)
	SkillUserStatus = skills.IDUserStatus
)

Skill ID constants for use with RunByID. These constants provide compile-time safety and IDE autocomplete for skill IDs. They are aliases to the constants in the skills package.

Example:

node := ork.NewNodeForHost("server.example.com")
err := node.Run(ork.SkillPing)

Variables

This section is empty.

Functions

func GetGlobalSkillRegistry added in v0.11.0

func GetGlobalSkillRegistry() (*types.Registry, error)

GetGlobalSkillRegistry returns the global skill registry singleton. This is syntactic sugar for user convenience - it lazily initializes and returns the global registry with all built-in skills pre-registered.

For most use cases, users should call this function. For testing or custom configurations, use NewDefaultRegistry() to create isolated registries.

The registry is lazily initialized on first call using sync.Once to ensure thread-safe singleton behavior. Returns an error if initialization fails.

func NewDefaultRegistry added in v0.10.0

func NewDefaultRegistry() (*types.Registry, error)

NewDefaultRegistry creates a new skill registry with all built-in skills registered. This creates a fresh registry instance (not a singleton), which is useful for: - Testing with isolated registries - Custom configurations without global state - Multiple independent registries in the same application

For most production use cases, use GetGlobalSkillRegistry() instead for convenience. Returns an error if any skill registration fails.

func NewNodeConfig added in v0.16.0

func NewNodeConfig() *types.NodeConfig

NewNodeConfig creates a new node configuration with default values. Use the fluent With* methods for configuration.

Example:

cfg := ork.NewNodeConfig().
    WithHost("server.example.com").
    WithPort("22").
    WithLogin("ubuntu").
    WithKey("/home/user/.ssh/id_rsa").
    WithDryRun(true)

func NewPlaybook added in v0.16.0

func NewPlaybook() *types.BasePlaybook

NewPlaybook creates a new base playbook for custom playbook implementations. Use this for creating custom playbooks with fluent configuration.

Example:

pb := ork.NewPlaybook().
    WithID("my-playbook").
    WithDescription("What this playbook does").
    WithDryRun(false)

node := ork.NewNodeForHost("server.example.com")
node.SetNodeConfig(cfg)
result := pb.Run()

func NewSkill added in v0.16.0

func NewSkill() *types.BaseSkill

NewSkill creates a new base skill for custom skill implementations. Use this for creating custom skills with fluent configuration.

Example:

skill := ork.NewSkill().
    WithID("my-skill").
    WithDescription("What this skill does").
    WithDryRun(false)

node := ork.NewNodeForHost("server.example.com")
node.SetNodeConfig(cfg)
result := skill.Run()

func NewSkillRegistry added in v0.11.0

func NewSkillRegistry() *types.Registry

NewSkillRegistry creates a new empty skill registry. This is a convenience method (sugar) for types.NewRegistry() with a more intuitive name. This creates a fresh empty registry instance, which is useful for: - Testing with isolated registries - Custom configurations with selective skill registration - Multiple independent registries in the same application

Returns an empty registry ready for custom skill registration.

func PromptForBool added in v0.11.0

func PromptForBool(prompt string) (bool, error)

PromptForBool prompts for a boolean value (yes/no).

func PromptForBoolWithDefault added in v0.11.0

func PromptForBoolWithDefault(prompt string, defaultValue bool) (bool, error)

PromptForBoolWithDefault prompts for a boolean value with a default.

func PromptForInt added in v0.11.0

func PromptForInt(prompt string) (int, error)

PromptForInt prompts for an integer value.

func PromptForIntWithDefault added in v0.11.0

func PromptForIntWithDefault(prompt string, defaultValue int) (int, error)

PromptForIntWithDefault prompts for an integer value with a default.

func PromptForPassword added in v0.11.0

func PromptForPassword(prompt string) (string, error)

PromptForPassword prompts for a password (hidden input).

func PromptForPasswordWithConfirmation added in v0.11.0

func PromptForPasswordWithConfirmation(prompt string) (string, error)

PromptForPasswordWithConfirmation prompts for a password with confirmation.

func PromptForString added in v0.11.0

func PromptForString(prompt string) (string, error)

PromptForString prompts for a string value.

func PromptForStringWithDefault added in v0.11.0

func PromptForStringWithDefault(prompt, defaultValue string) (string, error)

PromptForStringWithDefault prompts for a string value with a default.

func PromptMultiple added in v0.11.0

func PromptMultiple(configs []types.PromptConfig, existingValues ...map[string]string) (types.PromptResult, error)

PromptMultiple prompts for multiple variables using a configuration. Returns a map of variable names to user-provided values. Skips prompts for variables that already exist in the provided values map. Optionally pass existing values as a second argument.

Example:

prompts := []types.PromptConfig{
    {Name: "username", Prompt: "Username", Default: "admin", Required: true},
    {Name: "password", Prompt: "Password", Private: true, Confirm: true, Required: true},
}
results, err := ork.PromptMultiple(prompts)
if err != nil {
    log.Fatal(err)
}
username := results["username"]
password := results["password"]

func PromptPassword added in v0.10.0

func PromptPassword(prompt string) (string, error)

PromptPassword securely prompts for a password from stdin. The password is not echoed to the terminal.

func PromptWithOptions added in v0.11.0

func PromptWithOptions(prompt string, options []string) (int, error)

PromptWithOptions prompts the user to select from a list of options. Returns the index of the selected option (0-based).

Types

type CommandInterface added in v0.15.0

type CommandInterface interface {
	types.RunnableInterface

	// SetChdir sets the working directory for command execution.
	// The command will be executed as `cd <dir> && <command>`.
	// When combined with become, the order is: `cd <dir> && sudo -u <user> <command>`.
	SetChdir(dir string) CommandInterface

	// SetCommand sets the shell command to execute.
	SetCommand(cmd string) CommandInterface

	// SetRequired sets whether the command must succeed.
	SetRequired(required bool) CommandInterface

	// WithCommand sets the shell command and returns CommandInterface for chaining.
	// Short alias to SetCommand for consistent named-method fluent chaining.
	WithCommand(cmd string) CommandInterface

	// WithRequired sets whether the command must succeed and returns CommandInterface for chaining.
	// Short alias to SetRequired for consistent named-method fluent chaining.
	WithRequired(required bool) CommandInterface

	// WithChdir sets the working directory and returns CommandInterface for chaining.
	// Short alias to SetChdir for consistent named-method fluent chaining.
	WithChdir(dir string) CommandInterface

	// WithDescription sets a description and returns CommandInterface for chaining.
	// Use this instead of SetDescription when you need fluent chaining.
	WithDescription(description string) CommandInterface

	// WithID sets the ID and returns CommandInterface for chaining.
	// Use this instead of SetID when you need fluent chaining.
	WithID(id string) CommandInterface

	// WithArg sets a single argument and returns CommandInterface for chaining.
	// Use this instead of SetArg when you need fluent chaining.
	WithArg(key, value string) CommandInterface

	// WithArgs replaces the arguments map and returns CommandInterface for chaining.
	// Use this instead of SetArgs when you need fluent chaining.
	WithArgs(args map[string]string) CommandInterface

	// WithNodeConfig sets the node config and returns CommandInterface for chaining.
	// Use this instead of SetNodeConfig when you need fluent chaining.
	WithNodeConfig(cfg types.NodeConfig) CommandInterface

	// WithDryRun sets dry-run mode and returns CommandInterface for chaining.
	// Use this instead of SetDryRun when you need fluent chaining.
	WithDryRun(dryRun bool) CommandInterface

	// WithTimeout sets the timeout and returns CommandInterface for chaining.
	// Use this instead of SetTimeout when you need fluent chaining.
	WithTimeout(timeout interface{}) CommandInterface

	// WithBecomeUser sets the become user and returns CommandInterface for chaining.
	// Use this instead of SetBecomeUser when you need fluent chaining.
	WithBecomeUser(user string) CommandInterface
}

CommandInterface defines a fluent interface for executing shell commands. It provides a fluent builder pattern for configuring one-off commands that can be executed on nodes and inventories via the standard Run() methods.

Unlike skills (which are reusable and idempotent), commands are for simple shell command execution.

Fluent chaining note: Call Command-specific methods (SetCommand, SetRequired) first, then RunnableInterface methods (SetDescription, SetArg, etc.) to maintain the CommandInterface type for chaining.

Example:

command := ork.NewCommand().
    SetCommand("pm2 restart app").
    SetRequired(true)
command.SetDescription("Restart application")

// Run on a node
node := ork.NewNodeForHost("server.example.com")
result := node.Run(command)

// Run on an inventory
inventory := ork.NewInventory()
result := inventory.Run(command)

func NewCommand added in v0.15.0

func NewCommand() CommandInterface

NewCommand creates a new Command with default values. The command is not required to succeed by default.

Example:

command := ork.NewCommand().
    WithDescription("Restart application").
    WithCommand("pm2 restart app").
    WithRequired(true)

node := ork.NewNodeForHost("server.example.com")
result := node.Run(command)

type GroupInterface added in v0.9.0

type GroupInterface interface {
	// RunnerInterface is embedded for command and playbook execution.
	// Operations run on all nodes in this group only.
	RunnerInterface

	// GetName returns the group's name.
	GetName() string

	// AddNode adds a node to this group.
	// The node can be configured using the returned NodeInterface.
	AddNode(node NodeInterface) GroupInterface

	// GetNodes returns all nodes in this group.
	GetNodes() []NodeInterface

	// WithArg sets an argument for this group.
	// Group arguments are inherited by all nodes in the group.
	WithArg(key, value string) GroupInterface

	// SetArg sets an argument for this group.
	// Group arguments are inherited by all nodes in the group.
	SetArg(key, value string) GroupInterface

	// GetArg retrieves an argument value by key.
	// Returns empty string if not set.
	GetArg(key string) string

	// GetArgs returns a copy of all arguments defined for this group.
	GetArgs() map[string]string
}

GroupInterface defines operations for managing a group of nodes. It embeds RunnerInterface for executing operations on the group's nodes.

func NewGroup added in v0.9.0

func NewGroup(name string) GroupInterface

NewGroup creates a new group with the given name.

type InventoryInterface added in v0.9.0

type InventoryInterface interface {
	// RunnerInterface is embedded for command and playbook execution.
	// Operations run concurrently across all nodes in the inventory.
	RunnerInterface

	// AddGroup adds a group to the inventory.
	AddGroup(group GroupInterface) InventoryInterface

	// GetGroup retrieves a group by name.
	// Returns nil if the group does not exist.
	GetGroupByName(name string) GroupInterface

	// AddNode adds a node directly to the inventory (not in any specific group).
	// The node can be configured using the returned NodeInterface.
	AddNode(node NodeInterface) InventoryInterface

	// GetNodes returns all nodes in the inventory across all groups.
	GetNodes() []NodeInterface

	// SetMaxConcurrency sets the maximum number of concurrent operations.
	// Default is 1 (sequential execution). Set to 0 for unlimited.
	SetMaxConcurrency(max int) InventoryInterface
}

InventoryInterface defines operations for managing a collection of nodes organized into groups. It embeds RunnerInterface for executing operations across all nodes in the inventory.

func NewInventory added in v0.9.0

func NewInventory() InventoryInterface

NewInventory creates a new empty inventory.

type NodeInterface

type NodeInterface interface {
	// RunnerInterface defines operations that can be performed on the node.
	// NodeInterface embeds RunnerInterface for unified API with Group and Inventory.
	RunnerInterface

	// GetArg retrieves a single argument value by key.
	// Returns empty string if the argument is not set.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").SetArg("username", "alice")
	//	fmt.Println(node.GetArg("username"))  // Output: alice
	GetArg(key string) string

	// GetArgs returns a copy of the entire arguments map.
	// Modifying the returned map will not affect the node's internal state.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").SetArg("username", "alice")
	//	args := node.GetArgs()
	//	fmt.Println(args["username"])  // Output: alice
	GetArgs() map[string]string

	// GetNodeConfig returns a copy of the underlying types.NodeConfig.
	// This allows integration with code that uses the config package directly.
	// The returned configuration includes all accumulated settings (host, port, user, key, args).
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").
	//	    SetPort("2222").
	//	    SetUser("deploy")
	//	cfg := node.GetNodeConfig()
	//	fmt.Printf("Connecting to %s\n", cfg.SSHAddr())
	GetNodeConfig() types.NodeConfig

	// GetHost returns the configured SSH host (hostname or IP address).
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com")
	//	fmt.Println(node.GetHost())  // Output: server.example.com
	GetHost() string

	// GetUser returns the configured SSH user.
	// Returns "root" if not explicitly set.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").SetUser("deploy")
	//	fmt.Println(node.GetUser())  // Output: deploy
	GetUser() string

	// GetKey returns the configured SSH private key filename.
	// Returns "id_rsa" if not explicitly set.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").SetKey("production.prv")
	//	fmt.Println(node.GetKey())  // Output: production.prv
	GetKey() string

	// GetPort returns the configured SSH port.
	// Returns "22" if not explicitly set.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").SetPort("2222")
	//	fmt.Println(node.GetPort())  // Output: 2222
	GetPort() string

	// SetPort sets the SSH port for the connection.
	// Returns the NodeInterface to enable method chaining.
	// Default is "22" if not set.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").SetPort("2222")
	SetPort(port string) NodeInterface

	// WithPort sets the SSH port and returns NodeInterface for chaining.
	// Shortcut alias to SetPort for fluent interface convenience.
	WithPort(port string) NodeInterface

	// SetUser sets the SSH user for the connection.
	// Returns the NodeInterface to enable method chaining.
	// Default is "root" if not set.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").SetUser("deploy")
	SetUser(user string) NodeInterface

	// WithUser sets the SSH user and returns NodeInterface for chaining.
	// Shortcut alias to SetUser for fluent interface convenience.
	WithUser(user string) NodeInterface

	// SetKey sets the SSH private key filename for authentication.
	// The key is resolved to ~/.ssh/<keyname>.
	// Returns the NodeInterface to enable method chaining.
	// Default is "id_rsa" if not set.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").SetKey("production.prv")
	SetKey(key string) NodeInterface

	// WithKey sets the SSH key and returns NodeInterface for chaining.
	// Shortcut alias to SetKey for fluent interface convenience.
	WithKey(key string) NodeInterface

	// SetArg adds a single argument to the arguments map.
	// This adds to existing arguments without replacing them.
	// Arguments are passed to skills for configuration.
	// Returns the NodeInterface to enable method chaining.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com").
	//	    SetArg("username", "alice").
	//	    SetArg("shell", "/bin/bash")
	SetArg(key, value string) NodeInterface

	// WithArg sets a single argument and returns NodeInterface for chaining.
	// Shortcut alias to SetArg for fluent interface convenience.
	WithArg(key, value string) NodeInterface

	// SetArgs replaces the entire arguments map with the provided map.
	// Any existing arguments are discarded.
	// Arguments are passed to skills for configuration.
	// Returns the NodeInterface to enable method chaining.
	//
	// Example:
	//
	//	args := map[string]string{
	//	    "username": "alice",
	//	    "shell": "/bin/bash",
	//	}
	//	node := ork.NewNode("server.example.com").SetArgs(args)
	SetArgs(args map[string]string) NodeInterface

	// WithArgs replaces the arguments map and returns NodeInterface for chaining.
	// Shortcut alias to SetArgs for fluent interface convenience.
	WithArgs(args map[string]string) NodeInterface

	// Connect establishes a persistent SSH connection to the remote server.
	// The connection is maintained until Close() is called.
	// Subsequent RunCommand() and RunSkill() calls will reuse this connection.
	//
	// Returns an error if the connection fails, with a descriptive message
	// including the host and port.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com")
	//	if err := node.Connect(); err != nil {
	//	    log.Fatalf("Failed to connect: %v", err)
	//	}
	//	defer node.Close()
	Connect() error

	// Close terminates the persistent SSH connection and releases resources.
	// After calling Close(), IsConnected() will return false.
	// It is safe to call Close() multiple times or on a non-connected node.
	//
	// Returns an error if closing the connection fails.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com")
	//	node.Connect()
	//	defer node.Close()
	Close() error

	// IsConnected returns true if a persistent SSH connection is currently active.
	// Returns false if Connect() has not been called or if Close() was called.
	//
	// Example:
	//
	//	node := ork.NewNode("server.example.com")
	//	fmt.Println(node.IsConnected())  // Output: false
	//	node.Connect()
	//	fmt.Println(node.IsConnected())  // Output: true
	//	node.Close()
	//	fmt.Println(node.IsConnected())  // Output: false
	IsConnected() bool
}

NodeInterface defines the contract for managing a remote server via SSH. Implementations must support configuration via setter methods, connection management, command execution, and playbook execution.

The interface provides two patterns for configuration:

  • Fluent builder pattern: Chain setter methods for readable configuration
  • Getter methods: Inspect current configuration state

Connection management is explicit, allowing users to control the SSH connection lifecycle. Operations (RunCommand, RunPlaybook) can work with or without a persistent connection.

Example usage with fluent builder pattern:

node := ork.NewNode("server.example.com").
    SetPort("2222").
    SetUser("deploy").
    SetKey("production.prv")

if err := node.Connect(); err != nil {
    log.Fatal(err)
}
defer node.Close()

output, err := node.RunCommand("uptime")
if err != nil {
    log.Fatal(err)
}
fmt.Println(output)

Example usage without persistent connection:

node := ork.NewNode("server.example.com")
output, err := node.RunCommand("uptime")  // Creates one-time connection

Example usage with skills:

node := ork.NewNode("server.example.com").
    SetArg("username", "alice").
    SetArg("shell", "/bin/bash")

if err := node.Run("user-create"); err != nil {
    log.Fatal(err)
}

func NewNode

func NewNode() NodeInterface

NewNode creates a new Node with default configuration values. Unlike NewNodeForHost, this function takes no arguments and creates a node with an empty host. Use SetArg or SetArgs to configure the node.

Default values:

  • Host: "" (empty - must be set before connecting)
  • Port: "22"
  • User: "root"
  • Key: "id_rsa"
  • Args: empty map

Example:

node := ork.NewNode().
    SetHost("server.example.com").
    SetPort("2222").
    SetUser("deploy")

if err := node.Connect(); err != nil {
    log.Fatal(err)
}

func NewNodeForHost added in v0.3.0

func NewNodeForHost(host string) NodeInterface

NewNode creates a new Node with default configuration values. The host parameter specifies the remote server (hostname or IP address).

Default values:

  • Port: "22"
  • User: "root"
  • Key: "id_rsa"
  • Args: empty map

The returned NodeInterface can be configured using setter methods (SetPort, SetUser, SetKey, SetArg, SetArgs) before connecting.

Example:

node := ork.NewNode("server.example.com")
// Equivalent to:
// Node{
//     cfg: types.NodeConfig{
//         SSHHost: "server.example.com",
//         SSHPort: "22",
//         RootUser: "root",
//         SSHKey: "id_rsa",
//         Args: map[string]string{},
//     },
//     connected: false,
// }

Example with configuration:

node := ork.NewNode("server.example.com").
    SetPort("2222").
    SetUser("deploy").
    SetKey("production.prv")

func NewNodeFromConfig added in v0.3.0

func NewNodeFromConfig(cfg types.NodeConfig) NodeInterface

NewNodeFromConfig creates a new Node from an existing types.NodeConfig. This is useful when you have a pre-built configuration and want to create a Node from it directly.

The config is copied internally, so modifications to the original config after calling this function will not affect the Node.

Example:

cfg := types.NodeConfig{
    SSHHost:  "server.example.com",
    SSHPort:  "2222",
    RootUser: "deploy",
    SSHKey:   "production.prv",
    Args: map[string]string{"env": "production"},
}
node := ork.NewNodeFromConfig(cfg)

if err := node.Connect(); err != nil {
    log.Fatal(err)
}

type RunnerInterface added in v0.11.0

type RunnerInterface interface {
	// BecomeInterface provides privilege escalation capabilities.
	types.BecomeInterface
	// RunCommand executes a shell command and returns the output.
	// For Inventory, runs concurrently across all nodes.
	RunCommand(cmd string) types.Results

	// Run executes any runnable (command or skill).
	// For Inventory, runs concurrently across all nodes.
	Run(runnable types.RunnableInterface) types.Results

	// RunByID executes a skill by ID from the registry.
	// Deprecated: Use Run() instead.
	RunByID(id string, opts ...types.RunnableOptions) types.Results

	// Check runs the runnable's check mode to determine if changes would be made.
	// Sets Changed=true on result if changes are needed.
	Check(runnable types.RunnableInterface) types.Results

	// GetLogger returns the logger. Returns slog.Default() if not set.
	GetLogger() *slog.Logger

	// SetLogger sets a custom logger. Returns self for chaining.
	SetLogger(logger *slog.Logger) RunnerInterface

	// SetDryRunMode sets whether to simulate execution without making changes.
	// When true, ssh.Run() will log commands and return "[dry-run]" marker instead of executing.
	// Returns self for chaining.
	SetDryRunMode(dryRun bool) RunnerInterface

	// GetDryRunMode returns true if dry-run mode is enabled.
	// When true, commands are logged but not executed on the server.
	GetDryRunMode() bool
}

RunnerInterface defines operations that can be performed on either a single Node or an Inventory of nodes.

Directories

Path Synopsis
cmd
ork command
internal
Package skills provides built-in reusable skill implementations for common server automation tasks.
Package skills provides built-in reusable skill implementations for common server automation tasks.
apt
Package apt provides playbooks for managing Debian/Ubuntu packages via apt.
Package apt provides playbooks for managing Debian/Ubuntu packages via apt.
fail2ban
Package fail2ban provides playbooks for managing the fail2ban intrusion prevention system.
Package fail2ban provides playbooks for managing the fail2ban intrusion prevention system.
mariadb
Package mariadb provides playbooks for managing MariaDB database servers.
Package mariadb provides playbooks for managing MariaDB database servers.
ping
Package ping provides a skill for testing SSH connectivity to remote servers.
Package ping provides a skill for testing SSH connectivity to remote servers.
reboot
Package reboot provides a skill for rebooting remote servers.
Package reboot provides a skill for rebooting remote servers.
security
Package security provides playbooks for system security hardening and configuration.
Package security provides playbooks for system security hardening and configuration.
swap
Package swap provides playbooks for managing swap files on Linux systems.
Package swap provides playbooks for managing swap files on Linux systems.
ufw
Package ufw provides playbooks for managing the Uncomplicated Firewall (UFW).
Package ufw provides playbooks for managing the Uncomplicated Firewall (UFW).
user
Package user provides playbooks for managing Linux user accounts.
Package user provides playbooks for managing Linux user accounts.
Package ssh provides SSH connectivity utilities for remote server automation.
Package ssh provides SSH connectivity utilities for remote server automation.
Package types provides core types for SSH-based automation.
Package types provides core types for SSH-based automation.

Jump to

Keyboard shortcuts

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