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:
Option | Description |
---|---|
--config , -c | Configuration file path (default: spage.yaml ) |
--verbose , -v | Verbose output (can be used multiple times) |
--help , -h | Show help |
Commands
spage run
Run a playbook on target hosts.
spage run [OPTIONS] PLAYBOOK
Options
Option | Description |
---|---|
--inventory , -i | Inventory file or directory |
--limit , -l | Limit execution to specific hosts/groups |
--tags , -t | Only run tasks with these tags |
--skip-tags | Skip tasks with these tags |
--extra-vars , -e | Set additional variables (key=value or @file.yaml) |
--connection , -c | Connection type (local, ssh, etc.) |
--check | Don't make changes, just check what would be done |
--diff | Show 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
Option | Description |
---|---|
--output , -o | Output 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
Option | Description |
---|---|
--inventory , -i | Inventory file or directory |
Examples
# List all inventory
spage inventory list -i inventory.yaml
Configuration File Integration
CLI options take precedence over configuration file settings:
- Command line flags (highest priority)
- Environment variables
- Configuration file
- Built-in defaults (lowest priority)