Courseiva

EX294 Implement advanced Ansible automation Practice Question

A playbook uses the 'include_tasks' module to dynamically include tasks based on a variable. The playbook runs successfully on some hosts but fails on others with a 'template error' message. What is the most likely cause?

⚠ Common exam trap

Watch out — candidates often confuse the source of the template error, assuming it comes from the content of the included tasks (option D) rather than from the variable used in the include path itself, which is evaluated before the included file is even accessed.

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

✓

The variable used in the 'include_tasks' path has a Jinja2 template error.

The 'include_tasks' module dynamically resolves the path to a task file using a variable. If that variable contains a Jinja2 template error (e.g., undefined variable, syntax mistake, or filter misuse), Ansible will fail with a 'template error' message during the variable expansion phase, before the task file is even loaded. This explains why the error occurs only on hosts where the variable's value or context triggers the template failure.

Answer analysis

Option-by-option breakdown

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

  • ✗

    The included task file does not exist on the control node.

    Why it's wrong here

    include_tasks resolves the file path on the control node at runtime, so a missing file fails identically on every host, not only some. Host-specific failure points to a variable defined per host, such as a templated filename or undefined fact, rather than a control-node file absence.

  • ✓

    The variable used in the 'include_tasks' path has a Jinja2 template error.

    Why this is correct

    A Jinja2 template error in the variable used to build the include_tasks path renders an invalid filename on some hosts, causing the failure. This satisfies the scenario where the same playbook succeeds elsewhere because that variable resolves cleanly.

  • ✗

    The included task file has incorrect permissions.

    Why it's wrong here

    Incorrect permissions would produce a permission-denied or access failure, not a template error. The template error arises when a variable referenced in the included file is undefined on the failing hosts, so the file is reached but its templating fails. Permissions would block the file from loading entirely.

  • ✗

    The included tasks contain a syntax error.

    Why it's wrong here

    A syntax error would fail consistently on every host, since the file is parsed identically regardless of inventory. The intermittent pattern points to host-specific variable values feeding the template. Syntax errors are caught at parse time and are not host-dependent.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.