Pcornel
Automation · Configuration Management

Idempotency

Cheat sheet · https://pcornel.dk/topic.php?topic=5387

Back to the Topic

Answer

Idempotency in configuration management means each resource or module only changes a system when it differs from the desired state, so runs can repeat without side effects and report 'ok' when nothing changed.

Remember

  • Modules check before changing.
  • 'ok' means no change.
  • Shell commands need guards.

First checks

  • ansible-playbook site.yml; ansible-playbook site.yml — second run changed=0
  • ansible-lint (no-changed-when) — command tasks flagged
  • changed_when/creates on commands — guarded

Verify in this order

run → state matches → no changes on rerun

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5387

Confirmation

Confirm action

Continue?