Courseiva

EX294 Manage task execution and roles Practice Question

Exhibit

Refer to the exhibit.

```yaml
- name: Deploy web server
  hosts: webservers
  roles:
    - common
    - nginx
```

And the output of `ansible-playbook site.yml --check` shows:

```
PLAY [Deploy web server] *************************
TASK [common : include_vars] *********************
ok: [web1]
TASK [nginx : install nginx] *********************
fatal: [web1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'nginx_version' is undefined"}
```

What is the most likely cause of the failure?

⚠ Common exam trap

It's easy for candidates to assume the `--check` flag is the culprit for any failure during a dry run, but Ansible's check mode still resolves all variables and validates templates, so a missing variable error is not caused by the check flag itself.

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 nginx role's defaults or vars do not define 'nginx_version'.

The error indicates that Ansible cannot resolve the variable 'nginx_version' during the playbook run. Since the `--check` flag only simulates changes and does not affect variable resolution, the most likely cause is that the nginx role's `defaults/main.yml` or `vars/main.yml` does not define this variable, leaving it undefined and causing the 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 --check flag prevents role variable resolution.

    Why it's wrong here

    The --check flag performs a dry run, reporting changes without applying them; it does not block variable resolution, which occurs during parsing regardless. Dry runs suit validating playbook syntax and previewing changes before execution, so this cannot explain a genuine task failure during an actual run.

  • ✓

    The nginx role's defaults or vars do not define 'nginx_version'.

    Why this is correct

    The role references nginx_version, but neither defaults nor vars supply it. Ansible resolves variables from role defaults, vars, inventory, or playbook; with none defining nginx_version, the variable is undefined and templating fails during the play.

  • ✗

    The host web1 is not configured to use the nginx role.

    Why it's wrong here

    If web1 were absent from the play's hosts or role mapping, no nginx tasks would target it at all, producing skipped hosts rather than the reported task failure. Omitting a host suits excluding machines from a play; the failure stems from something occurring during task execution on web1.

  • ✗

    The nginx role was not included in the playbook correctly.

    Why it's wrong here

    An incorrectly included role typically triggers a parse or role-not-found error before any tasks execute, not a runtime task failure. Role inclusion errors suit diagnosing malformed playbook structure; a task that starts and then fails points to task-level execution, not the include statement itself.

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.