Managing large Ansible outputs
The Ansible plugin automatically manages large playbook outputs through truncation and file export options. This ensures reliable telemetry while preserving access to full execution details.
View Ansible output
Ansible execution results are available in multiple locations:
- Pipeline Run: Execution logs and summary statistics
- Playbook/Inventory Activity History: Historical execution data
- Host View: Per-host task results and status
- Custom Export: Full output to file. Go to Export full output to file to configure file-based output.
- Output Variables: Export data for use in subsequent pipeline steps. Go to Output variables for Ansible to configure output variables.
Automatic truncation
The Ansible plugin applies two levels of truncation to manage output size.
Message truncation (per-task)
Applies to: Individual task msg and skip_reason fields exceeding 1000 characters
Action: Truncates to 1000 characters with " ... [truncated]" suffix
Configuration:
ANSIBLE_MAX_TASK_MSG_SIZE=1000 # Default: 1000 characters
Example:
{
"name": "Install packages",
"status": "ok",
"msg": "Long command output... [truncated]",
"duration_ms": 5432
}
Circuit breaker (payload size limit)
Trigger: Final JSON payload exceeds 5 MB
Behavior:
- Removes all
tasksarrays from host results - Preserves host-level stats (changed, failures, ok, rescued, skipped, unreachable)
- Preserves metadata (playbook, inventory, status, duration)
Example output:
⚠️ WARNING: Ansible payload exceeds maximum size limit:
Payload size: 5.5 MB
Limit: 5 MB
Hosts: 100
Sending summary-only payload to server for telemetry.
Summary payload size: 12.57 KB (original: 5.47 MB)
What's preserved:
{
"playbook": "deploy-app",
"inventory": "prod-inventory",
"status": "success",
"duration_ms": 45320,
"hosts": {
"web-01": {
"address": "10.0.1.5",
"stats": {
"ok": 150,
"changed": 20,
"failures": 0,
"skipped": 5
}
}
}
}
Export full output to file
When truncation occurs, detailed task information is removed from telemetry. Export full output to a file for debugging complex failures, compliance and audit requirements, or long-term archival.
Configure file export
Set the ANSIBLE_OUTPUT_FILE environment variable to specify the output file path:
ANSIBLE_OUTPUT_FILE=ansible-output.json
File export behavior
- Writes complete structured output before any truncation
- Includes all hosts, tasks, and messages in full
- Pretty-printed JSON format
- Truncation still applies to telemetry payload
Example output
Writing full output to file: ansible-output.json
📝 Full ansible output written to: /harness/ansible-output.json (8.42 MB)
Inventory: prod-inventory | Playbook: deploy-app
Upload output to object storage
When ANSIBLE_OUTPUT_FILE is configured, the output file can be uploaded to cloud storage (S3, GCS, Azure Blob) as a subsequent pipeline step.
Go to Upload and download artifacts to review configuration options for uploading artifacts to object storage.
Log output examples
No truncation:
Payload size: 2.34 MB (limit: 5 MB)
With truncation:
⚠️ WARNING: Ansible payload exceeds maximum size limit:
Payload size: 25.8 MB
Limit: 5 MB
Hosts: 200
Sending summary-only payload to server for telemetry.
Summary payload size: 82.45 KB (original: 25.80 MB)
Configuration reference
| Variable | Default | Description |
|---|---|---|
ANSIBLE_MAX_TASK_MSG_SIZE | 1000 | Maximum characters for task message fields |
ANSIBLE_OUTPUT_FILE | (unset) | Path to write full output before truncation |