Why run the same playbook a second time, and what should the recap show?
To prove it is idempotent: the first run reports changed=2 (package installed, file copied), the second run should report ok=4 changed=0, because everything is already in the desired state.
* Same playbook, same hosts: the second run finds nothing left to do. *
In the Apache lab, the first run shows:
- Gathering Facts:
ok - Install httpd:
changed(apache2 was installed) - Copy index.html:
changed(the file was new) - Start service:
ok(on Debian the package starts Apache on install, so it was already running)
Recap: ok=4 changed=2 unreachable=0 failed=0.
The second run should change nothing: ok=4 changed=0. That is the practical test of a good playbook. If a task reports changed on every run, it is either not idempotent (a command/shell task, an appending echo >>) or something on the host keeps drifting, and both deserve attention. A clean second run also means you can safely rerun the playbook any time to repair drift.
Go deeper:
Ansible playbooks: desired state and idempotency (official docs) — why modules report
changedonly on a real change.General tips (official docs) — writing playbooks that stay idempotent.