playbook

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package playbook provides the base types and interfaces for creating automation playbooks using SSH-based remote execution.

Index

Constants

View Source
const (
	// NamePing checks SSH connectivity
	NamePing = "ping"

	// NameAptUpdate refreshes the package database
	NameAptUpdate = "apt-update"

	// NameAptUpgrade installs available updates
	NameAptUpgrade = "apt-upgrade"

	// NameAptStatus shows available updates
	NameAptStatus = "apt-status"

	// NameReboot reboots the server
	NameReboot = "reboot"

	// NameSwapCreate creates a swap file (requires "size" arg in GB)
	NameSwapCreate = "swap-create"

	// NameSwapDelete removes the swap file
	NameSwapDelete = "swap-delete"

	// NameSwapStatus shows swap status
	NameSwapStatus = "swap-status"

	// NameUserCreate creates a user with sudo (requires "username" arg)
	NameUserCreate = "user-create"

	// NameUserDelete deletes a user (requires "username" arg)
	NameUserDelete = "user-delete"

	// NameUserStatus shows user info (accepts optional "username" arg)
	NameUserStatus = "user-status"
)

Playbook name constants for use with RunPlaybook. These constants provide compile-time safety and IDE autocomplete for playbook names.

Example:

node := ork.NewNodeForHost("server.example.com")
err := node.RunPlaybook(playbook.NamePing)

Variables

This section is empty.

Functions

This section is empty.

Types

type Playbook

type Playbook interface {
	// Name returns the unique identifier for this playbook (e.g., "apt-update")
	Name() string

	// Description returns a short description of what the playbook does
	Description() string

	// Run executes the playbook with the given configuration
	Run(config config.Config) error
}

Playbook is the interface that all playbooks must implement. A playbook is a self-contained automation task that runs on a remote server.

type Registry

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

Registry holds a collection of playbooks.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new playbook registry.

func (*Registry) Get

func (r *Registry) Get(name string) (Playbook, bool)

Get retrieves a playbook by name.

func (*Registry) List

func (r *Registry) List() []Playbook

List returns all registered playbooks.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns all registered playbook names.

func (*Registry) Register

func (r *Registry) Register(p Playbook)

Register adds a playbook to the registry.

type SimplePlaybook

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

SimplePlaybook is a function-based playbook implementation. Use this for simple playbooks that don't need complex state.

func NewSimplePlaybook

func NewSimplePlaybook(name, description string, runFn func(config.Config) error) *SimplePlaybook

NewSimplePlaybook creates a new simple playbook from a function.

func (*SimplePlaybook) Description

func (p *SimplePlaybook) Description() string

Description returns the playbook description.

func (*SimplePlaybook) Name

func (p *SimplePlaybook) Name() string

Name returns the playbook name.

func (*SimplePlaybook) Run

func (p *SimplePlaybook) Run(cfg config.Config) error

Run executes the playbook.

Jump to

Keyboard shortcuts

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