DEVOPS / A CONCEPT NOTE
Idempotency
why running twice must be safe
Overview · mechanism
pitfall · examples
01 / THE SHORT VERSION
The idea in a few sentences.
A property where executing an operation multiple times produces the exact same result as executing it once, preventing resource duplication or configuration errors.
02 / FOLLOW THE MECHANISM
How idempotent runs flow
First execution
playbook/script runs, detects resource missing, and creates it.
Second execution
runs, detects resource already exists, and reports ok (no changes).
Failsafe check
operations evaluate current state before modifying resource attributes.
Result
system stays in the desired configuration state without duplicating objects.
04 / COMMAND NOTES
Read the command, then the result.
Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.
verify if tasks will make changes without altering target state
ansible-playbook --check playbook.ymlidempotently create a directory (succeeds even if folder exists)
mkdir -p my-dir05 / CHECK YOURSELF
Could you explain Idempotency to a teammate?
Try it out loud in two sentences: what it is, and the one detail that changes the picture. If you stall, the gap is the part to reread.
Up next in Delivery & operationsSemantic Versioningwhat 2.1.3 promises