Question 1
Topic: Understand core components of Ansible
Skill tested: Uses registered command results and conditionals to control Ansible task execution.
A fleet-maintenance playbook must run a vendor-provided diagnostic command on each managed host, then create `/var/tmp/maintenance-needed` only when that command reports that maintenance is due. The command returns a nonzero status when maintenance is not due, but that outcome is expected and must not mark the host failed. The command's output includes the phrase `maintenance required` when action is needed. Which task design meets these requirements without relying on a fact from a different host?
Registering the result makes the command's stdout available to later tasks for the same host. Setting `failed_when: false` prevents the expected nonzero return code from aborting the play, while the file task's `when` condition can inspect the returned text. `ignore_errors` suppresses failure but does not make an unrelated fact contain command output. `changed_when` controls change reporting, not failure, and the stated nonzero status is not a reliable trigger for the required phrase. A handler runs only after notification and is not a substitute for evaluating the diagnostic output.