LOGBOOK

HELP

Quiz Entry - updated: 2026.10.22

What does idempotent mean in Ansible, and why does it matter?

Running the same task or playbook again gives the same end result; if the system is already in the desired state, nothing is changed.

The same nginx task run twice: run 1 installs it and reports changed, run 2 finds it installed and reports ok

* Running the task again leaves a correct host untouched and reports ok instead of changed. *

Example: a task "make sure package nginx is installed".

  • First run: nginx is missing, so Ansible installs it and reports changed.
  • Second run: nginx is already installed, so Ansible does nothing and reports ok.

Compare that with a shell script that runs echo "export PATH=..." >> ~/.bashrc: every run appends another line.

Idempotency is what makes it safe to run a playbook many times on the same hosts. You can re-run after a partial failure, run regularly to correct drift, or run against a mix of new and existing servers, without worrying about breaking what is already correct.

Go deeper:

From Quiz: ITIA / Ansible Fundamentals: Automation, Architecture and the Automation Platform | Updated: Oct 22, 2026