Executors
Spage uses executors to run your playbooks. Choose between local execution which executes directly on the host, or execution with Temporal which executes through a Temporal worker.
By default, Spage uses the local executor.
Local Executor
Runs tasks directly on your machine, or run on remote hosts using SSH connections. This mode works similar to Ansible, and is the default executor.
How it works
- Uses Go goroutines for parallel execution
- Connects to hosts via SSH
- No external dependencies
Configuration
executor: local
execution_mode: parallel # Or 'sequential'
Usage
# Default executor
spage run playbook.yaml
# With config file
spage run playbook.yaml --config spage.yaml
Example config
executor: local
execution_mode: parallel
revert: true
ssh:
auth:
methods: ["publickey"]
Temporal Executor
Runs tasks through Temporal workflows for distributed execution.
How it works
The concepts of tasks and plays are converted into Temporal-native concepts, such as workflows and activities. The play is converted into a Temporal workflow, and the tasks are converted into Temporal activities. Metatasks are converted into Temporal workflows, and its children are converted into Temporal activities (or workflows, if they are metatasks).
The Temporal executor is typically useful if you want to make use of Temporal's features, such as durable execution, or if you want to distribute the execution of tasks across multiple workers.
Prerequisites
You need to have a Temporal server running. Spage will start the Temporal worker for you.
Configuration
executor: temporal
temporal:
address: temporal.example.com:7233
task_queue: spage-prod
Configuration options
Option | Default | Description |
---|---|---|
temporal.address | localhost:7233 | Temporal server address |
temporal.task_queue | SPAGE_DEFAULT_TASK_QUEUE | Task queue name |
temporal.workflow_id_prefix | spage-workflow | Workflow ID prefix |
Usage
# With config file
spage run playbook.yaml --config temporal.yaml
# With environment variables
export SPAGE_EXECUTOR=temporal
export SPAGE_TEMPORAL_ADDRESS=temporal.example.com:7233
spage run playbook.yaml
Example config
executor: temporal
execution_mode: parallel
temporal:
address: temporal.company.com:7233
task_queue: infrastructure
workflow_id_prefix: deploy
trigger: true
logging:
level: info
format: json