Concepts / Automation and APIs

Automation and APIs

Idempotence

Also called idempotent, changed=0, desired state, declarative

Doing it again changes nothing: a run that describes a state leaves a device already in that state alone.

An idempotent playbook compares what is with what should be and changes only the difference, so a second run reports changed=0. That makes it safe to run on a schedule, and makes changed mean something: a device was not as described. A script of commands is not idempotent: replaying it may add a line twice or fail on one that exists. HTTP has the same idea: PUT and DELETE are idempotent, POST is not.

See it on real machines

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab