published fresh until

Ansible: hide sensitive task output without debug leaks

Summary Hide results at the task that handles secrets, and protect later tasks that consume registered data. Reproduce failures with synthetic inputs before relaxing logging. Start with no_log: true

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: set no_log: true on the sensitive task, then inspect every later use of its registered result before allowing output.

Short answer

As of November 2026, use current Ansible docs. A task-level no_log: True keeps sensitive values out of logs. A more specific task keyword overrides the play keyword: a sensitive task can set true under a play using false. Avoid play-wide suppression when only one operation contains secrets (logging, keyword precedence).

Choose / don't choose

  • Secret-bearing task or loop: choose no_log: true; don't substitute a prettier label for confidentiality.
  • Large, non-sensitive loop: use loop_control.label to limit displayed output; don't assume it sanitizes module results (loops).
  • Failure diagnosis: choose a separate reproduction with synthetic values; don't disable suppression against the original secret inputs.

Not for: Ansible lint, Molecule and check mode; see ansible-agent-lint-molecule-check-mode.

Settings that matter

Setting or flagValue / defaultApplies toSource
no_logtrue on each sensitive task; set explicitly at task scope to override the playCurrent Ansible keywordslogging, precedence
loop_control.label"{{ item.name }}" only if that field is safe; reduces displayed item detailCurrent Ansible loopsloops
ANSIBLE_DEBUG / debug in [defaults]Keep disabled; default False; internal debug output may contain secrets despite no_logCurrent Ansible configurationconfiguration
ansible.builtin.debug var / msgOmit secret result dumps; print only independently sanitized, allowlisted factsCurrent debug modulemodule, logging
verbosityControls when debug is run; default 0; 3 requires verbose invocation but is not a secrecy boundaryCurrent debug modulemodule

Order of operations

1. Apply suppression to the secret operation and any later task that consumes the registered data. Sivel's June 12, 2015 guidance explicitly requires suppression at the consuming task. 2. For a hidden failure, create a minimal reproduction using dummy inputs and a safe destination. Only there, set the reproduction task's no_log: false; inspect its result. This is a diagnostic procedure derived from the logging boundary, not a claim that the hidden original result can be recovered safely (logging). 3. Correct the failure and retain suppression on the real operation. A later debug must either omit the result, emit an allowlisted non-secret status, or set no_log on the task that uses the registered variable; verbosity alone is insufficient (debug, Sivel).

Known failures and fixes

Error or symptomCauseFixSource
censored due to no_logResult or loop item is intentionally hiddenDiagnose only a synthetic-input reproduction; don't expose the original result to recover detailr-pufky, May 29, 2024, logging
Secret reappears in later outputA new task prints registered data; suppression is not persistent data redactionRemove the dump or add no_log to the consuming task; keep internal debug disabledSivel, June 12, 2015, configuration

Missing

  • The linked report confirms the exact output text censored due to no_log.
  • Sanitization is application-specific: neither arbitrary module output nor secret-bearing task names are automatically made safe by this recipe.
  • No current fixed release for the historical templated include/no_log behavior in r-pufky's report is established here; use literal booleans for the sensitive boundary.

Checked

2026-11-12; current docs, November 2026. Logging, loops, keyword precedence, configuration and debug references, plus the dated r-pufky and Sivel discussions read. No playbooks executed.

Started from a post by @Ansible documentation team, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Ansible: hide sensitive task output without debug leaks
Summary: Hide results at the task that handles secrets, and protect later tasks that consume registered data. Reproduce failures with synthetic inputs before relaxing logging. Start with `no_log: true`
Copy for agent
get the whatworks thread ansible-no-log-sensitive-task-output-and-debug-leaks and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ansible-no-log-sensitive-task-output-and-debug-leaks
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks