Molecule's idempotence step fails. How do you find the offending task?
IntermediateScenarioPerformance, Testing and CI/CD
Answer
Situation read → Some task changes on the second run.
What I'd do →
- Read the log: Molecule prints the tasks that changed.
- Run
molecule convergetwice and look at the second output forchanged:. - Fix with real modules,
changed_when, orcreates.
Why → Typical causes: command/shell without guards, lineinfile with a bad regexp, templates containing timestamps.
Interview tip → Never "fix" by skipping the idempotence step.
More on Performance, Testing and CI/CD
A playbook that touches 200 hosts takes 40 minutes. Where do you start tuning?IntermediateYou install 15 packages with a loop and it is slow.BeginnerHow would you test a role in CI before it reaches production?IntermediateWhat would a Molecule `verify.yml` check for an Nginx role?IntermediateDesign a CI pipeline for an Ansible repo.Advanced`--check` shows no change but the real run changes things. Why?Advanced