Interview Prep/Ansible/Ad-hoc Commands, Modules and Idempotency

What is idempotency and why does it matter?

BeginnerConceptAd-hoc Commands, Modules and Idempotency
Answer

An operation is idempotent if running it once or ten times leaves the system in the same final state. For Ansible this means a second run reports changed=0.

It matters because it lets you re-run playbooks safely after a partial failure, use them as drift correction, and run them in CI as a test. A playbook that is not idempotent (for example appending a line with shell: echo >> file) corrupts state over repeated runs.

All Ansible questions Roadmap: Ansible

More on Ad-hoc Commands, Modules and Idempotency