> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/infrastructure-as-code-management/3.0/use-iacm/configuration-management/managing-large-outputs.md).

# Managing Large Ansible Outputs

Understand how the Ansible plugin manages large playbook outputs through truncation and file export.

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](#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](/infrastructure-as-code-management/3.0/use-iacm/configuration-management/output-variables-for-ansible.md) 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 <a href="#configuration" id="configuration"></a>

```bash
ANSIBLE_MAX_TASK_MSG_SIZE=1000  # Default: 1000 characters
```

#### Example <a href="#example" id="example"></a>

```json
{
  "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 <a href="#behavior" id="behavior"></a>

* Removes all `tasks` arrays from host results
* Preserves host-level stats (changed, failures, ok, rescued, skipped, unreachable)
* Preserves metadata (playbook, inventory, status, duration)

#### Example output <a href="#example-output" id="example-output"></a>

```
⚠️  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 <a href="#whats-preserved" id="whats-preserved"></a>

```json
{
  "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:

```bash
ANSIBLE_OUTPUT_FILE=ansible-output.json
```

### File export behavior

1. Writes complete structured output before any truncation
2. Includes all hosts, tasks, and messages in full
3. Pretty-printed JSON format
4. 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 [Build and upload artifacts](/continuous-integration/3.0/use-harness-ci/use-harness-ci/build-and-upload-artifacts/build-and-upload-an-artifact.md) to review configuration options for uploading artifacts to object storage.

***

## Log output examples

### No truncation <a href="#no-truncation" id="no-truncation"></a>

```
Payload size: 2.34 MB (limit: 5 MB)
```

### With truncation <a href="#with-truncation" id="with-truncation"></a>

```
⚠️  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 |

***

## FAQ

<details>

<summary>Why is my task output truncated?</summary>

Individual task messages exceeding 1KB are automatically truncated. Set the ANSIBLE\_OUTPUT\_FILE environment variable to preserve full output to a file.

</details>

<details>

<summary>Why don't I see task details in the UI?</summary>

When payload exceeds 5MB, task arrays are removed and only host-level stats are sent. Set the ANSIBLE\_OUTPUT\_FILE environment variable to capture full details to a file.

</details>

<details>

<summary>Can I increase the 5MB limit?</summary>

The 5MB limit is fixed to ensure system stability. Use ANSIBLE\_OUTPUT\_FILE to capture full output to a file instead.

</details>

<details>

<summary>Does truncation affect billing?</summary>

No. Host-level stats are always preserved and used for usage tracking.

</details>

<details>

<summary>Where should I store the output file?</summary>

The /harness/ directory is recommended. The file persists within the step execution and can be uploaded to object storage in a subsequent pipeline step.

</details>

***

## Related concepts

* Go to [Output variables for Ansible](/infrastructure-as-code-management/3.0/use-iacm/configuration-management/output-variables-for-ansible.md) to export data from playbooks to other pipeline steps.

{% @harness-feedback/feedback %}
