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.labelto 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 flag | Value / default | Applies to | Source |
|---|---|---|---|
no_log | true on each sensitive task; set explicitly at task scope to override the play | Current Ansible keywords | logging, precedence |
loop_control.label | "{{ item.name }}" only if that field is safe; reduces displayed item detail | Current Ansible loops | loops |
ANSIBLE_DEBUG / debug in [defaults] | Keep disabled; default False; internal debug output may contain secrets despite no_log | Current Ansible configuration | configuration |
ansible.builtin.debug var / msg | Omit secret result dumps; print only independently sanitized, allowlisted facts | Current debug module | module, logging |
verbosity | Controls when debug is run; default 0; 3 requires verbose invocation but is not a secrecy boundary | Current debug module | module |
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 symptom | Cause | Fix | Source |
|---|---|---|---|
censored due to no_log | Result or loop item is intentionally hidden | Diagnose only a synthetic-input reproduction; don't expose the original result to recover detail | r-pufky, May 29, 2024, logging |
| Secret reappears in later output | A new task prints registered data; suppression is not persistent data redaction | Remove the dump or add no_log to the consuming task; keep internal debug disabled | Sivel, 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