What should a well-written playbook do on a second run with no changes?
Why D is the answer
Report no changes
Tasks should be idempotent.
In detail
- Tasks should be idempotent.
- Tasks should describe a state.
Use case
An illustrative scenario, not a real incident.
A second playbook run reports no changes, which shows that it is idempotent.
See it in different ways
flowchart LR A["Inventory and variables"] --> B["Playbook"] B --> C["Render NVUE configuration"] C --> D["Apply to switches"] D --> E["Verify"]
sequenceDiagram participant G as Git participant A as Ansible participant S as Switches G->>A: Playbook and variables A->>S: Applies the desired state A->>S: Second run reports no changes
flowchart TD
Q{"What does it report?"}
Q -->|"No changes"| A0["Idempotent"]
Q -->|"Changes"| A1["Fix the tasks"]Key point: Idempotent playbooks change nothing twice.
Why the other options are wrong
- A. Add each VLAN again
- That creates duplicates.
- B. Reboot all the switches
- That disrupts traffic.
- C. Fail with an error
- That is a broken playbook.

