Debugger

概述

参考:

Ansible 提供了一个任务调试器,因此您可以在执行过程中修复错误,而不是编辑 playbook 并再次运行它以查看更改是否有效。您可以在任务上下文中访问调试器的所有功能。您可以检查或设置变量的值,更新模块参数,并使用新的变量和参数重新运行任务。调试器可让您解决故障原因并继续执行 playbook。

Enabling the debugger with thedebuggerkeyword

You can use the debugger keyword to enable (or disable) the debugger for a specific play, role, block, or task. This option is especially useful when developing or extending playbooks, plays, and roles. You can enable the debugger on new or updated tasks. If they fail, you can fix the errors efficiently. The debugger keyword accepts five values:

ValueResult
alwaysAlways invoke the debugger, regardless of the outcome
neverNever invoke the debugger, regardless of the outcome
on_failedOnly invoke the debugger if a task fails
on_unreachableOnly invoke the debugger if a host is unreachable
on_skippedOnly invoke the debugger if the task is skipped

最后修改 October 4, 2023: 合并 commit (98ba273b)