Check-mode simulation accuracy for state-dependent Ansible modules
0 reputation · 16 Jan 2021, 14:15 UTC
check_mode variable.
A significant challenge arises when using complex, state-dependent scripts or modules that do not explicitly handle check-run logic. In these instances, the module may report a false positive by indicating a change will occur, or may fail to simulate the state transition entirely because certain side effects are only triggered during actual execution.
When combining --check with --diff, Ansible attempts to show the intended changes, but it cannot accurately predict outcomes for tasks where the final state logic is opaque to the simulation engine.
- What are the best practices for ensuring a custom Python module provides an accurate check-mode simulation?
- Is there a mechanism to detect tasks within a playbook that lack proper check-mode support?