execute_on_group
Executes a shell command on all servers in a specified group in parallel. Supports configurable timeouts, working directories, dry-run, and fail-fast modes, returning per-server results.
Instructions
Execute a shell command on all servers in a group in parallel.
Concurrency is capped by the max_parallel_hosts setting (default 10;
configure in [settings] of servers.toml, range 1–100). The semaphore is
PROCESS-WIDE, not per call: concurrent execute_on_group calls share the same
slots and therefore serialise against each other for their share of them.
Args:
group: Group name (e.g. 'production', 'web'). Use list_groups to see
available groups.
command: Shell command to execute on every server in the group.
Rejected if it exceeds max_command_bytes (default 65536
encoded UTF-8 bytes).
timeout: Per-server command timeout in seconds. Default 30. Not
range-checked, and overridden per server by a timeout set
on that server's entry in servers.toml.
Each server has its own timer; slow servers do NOT extend the
per-server limit for others.
working_dir: Absolute remote directory to cd into on each server.
Uses each server's default_dir if omitted.
fail_fast: If True, cancel remaining tasks as soon as any server
returns a non-zero exit code or errors. Default False —
run all servers to completion and report each result.
force: If True, bypass the dangerous-command detection patterns. Use
only for audited bulk operations. The same broad block list
described under execute applies here — including plain
bash -c / python3 -c / eval wrappers. Default False.
dry_run: If True, do NOT connect or execute anywhere. Return a
per-server preview describing what would run. Dangerous-
command detection still applies. Useful for previewing
fleet-wide rollouts before committing. Default False.
Returns: Formatted summary showing per-server results, success/failure counts, and aggregate exit status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | ||
| group | Yes | ||
| command | Yes | ||
| dry_run | No | ||
| timeout | No | ||
| fail_fast | No | ||
| working_dir | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |