CompTIA Linux+ free question 7 / 10 · Domain 4: Automation, Orchestration, and Scripting
An administrator runs the same Ansible playbook twice against a host. After the first run the host is in the state that the playbook describes. What does the Introduction to Ansible say happens on the second run?
- Ansible runs the tasks a second time and reports a change for the tasks that it runs on the host
- Ansible leaves the host as it is, with the system already in the state the playbook describes
- Ansible asks a central server for the list of tasks that are still open for the host
- Ansible installs a small agent on the host to track which tasks ran in the earlier run
Show the answer and explanation
Answer: B
Why this is correct
The Introduction to Ansible lists the principles that Ansible is designed around, and idempotence and predictability is one of them. When the system is in the state that the playbook describes, Ansible does not change anything, even if the playbook runs multiple times. The playbook declares the desired state, and Ansible works agent-less over SSH with existing OS credentials.
Why the other options are wrong
"Ansible runs the tasks a second time and reports a change for the tasks that it runs on the host" … The page lists idempotence and predictability among the principles of Ansible: when the system is in the described state, Ansible does not change anything, even if the playbook runs multiple times.
"Ansible installs a small agent on the host to track which tasks ran in the earlier run" … The page describes an agent-less architecture, with low maintenance overhead by avoiding the installation of additional software across the IT infrastructure.
"Ansible asks a central server for the list of tasks that are still open for the host" … The page describes Ansible as decentralized, using SSH with existing OS credentials to access remote machines. It does not describe a central server that tracks open tasks.
Key points
Ansible playbooks declare a desired state. Running a playbook again on a host that already matches changes nothing, and no agent is installed on the host.
Go to the CompTIA Linux+ practice app (10 free questions; purchase unlocks all questions)