Courseiva

EX294 Implement advanced Ansible automation Practice Question

A playbook includes a role that has a task notifying a handler defined within the role. Another task in the play, outside the role, also notifies the same handler by name. After running the playbook, the administrator notices that the handler runs only once. What is the reason for this behavior?

⚠ Common exam trap

The trap here is thinking that handlers run immediately upon notification or that they are scoped to roles. In fact, they are queued and run once at the end of the play.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Handlers are executed only once per play, even if notified multiple times.

Handlers in Ansible are run once per play at the end, even if notified multiple times. This is by design to avoid multiple restarts of a service. The handler's scope is not limited to the role; it can be notified from anywhere in the play. The correct explanation is that handlers are deduplicated and executed once.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Handlers are executed immediately when notified, so the first notification triggers it and the second is ignored.

    Why it's wrong here

    Handlers are not executed immediately; they are queued and run at the end of the play by default. If they ran immediately, the first notification would trigger the handler, but subsequent notifications would still queue it again. In reality, Ansible deduplicates notifications, so it runs once at the end.

  • ✓

    Handlers are executed only once per play, even if notified multiple times.

    Why this is correct

    Ansible handlers are designed to run only once at the end of a play, regardless of how many times they are notified. This prevents redundant service restarts. Even if multiple tasks notify the same handler, it will execute a single time after all tasks complete, unless explicitly flushed.

  • ✗

    The handler runs only if the notifying task reports a changed status, and both tasks reported 'ok'.

    Why it's wrong here

    Handlers are notified only when a task reports a changed status. If both tasks reported 'ok', they would not notify the handler at all, and it would not run. The scenario states the handler runs once, implying at least one task changed. This option incorrectly assumes both tasks were 'ok'.

  • ✗

    The handler is scoped to the role and cannot be notified from outside the role.

    Why it's wrong here

    Handlers defined in a role are available to the entire play and can be notified by tasks outside the role, as long as the role is included. The handler's name is globally accessible within the play. Therefore, the handler running once is not due to scoping limitations.

About these practice questions

This EX294 question is part of Courseiva's 392-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Red Hat exam blueprint

This EX294 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX294 exam.