Skip to main content

Command Line Interface

Spage provides a comprehensive command-line interface for running playbooks, managing inventory, and more.

Global Options

These options are available for all commands:

OptionDescription
--config, -cConfiguration file path (default: spage.yaml)
--verbose, -vVerbose output (can be used multiple times)
--help, -hShow help

Commands

spage run

Run a playbook on target hosts.

spage run [OPTIONS] PLAYBOOK

Options

OptionDescription
--inventory, -iInventory file or directory
--limit, -lLimit execution to specific hosts/groups
--tags, -tOnly run tasks with these tags
--skip-tagsSkip tasks with these tags
--extra-vars, -eSet additional variables (key=value or @file.yaml)
--connection, -cConnection type (local, ssh, etc.)
--checkDon't make changes, just check what would be done
--diffShow differences when changing files

Examples

# Basic playbook execution
spage run playbook.yaml

# Run with specific inventory
spage run -i inventory.yaml playbook.yaml

# Limit to specific hosts
spage run -l web_servers playbook.yaml

# Run with tags
spage run -t deploy,config playbook.yaml

# Check mode (dry run)
spage run --check playbook.yaml

# With extra variables
spage run -e "env=production" playbook.yaml

spage generate

Generate Go code from a playbook for compilation.

spage generate [OPTIONS] PLAYBOOK

Options

OptionDescription
--output, -oOutput file path (default: generated_tasks.go)

Examples

# Generate Go code
spage generate playbook.yaml

# Custom output file
spage generate -o my_tasks.go playbook.yaml

spage inventory

Manage and inspect inventory.

spage inventory list

List all hosts and their variables.

spage inventory list [OPTIONS]
Options
OptionDescription
--inventory, -iInventory file or directory
Examples
# List all inventory
spage inventory list -i inventory.yaml

Configuration File Integration

CLI options take precedence over configuration file settings:

  1. Command line flags (highest priority)
  2. Environment variables
  3. Configuration file
  4. Built-in defaults (lowest priority)