EX294 Manage task execution and roles Practice Question
You are managing a web application deployment using Ansible. The application requires a specific version of a library (libapp) to be installed on all web servers. Your current playbook uses the role 'web' which includes a task to install libapp version 1.2. However, after a recent update, the role's defaults now specify libapp version 2.0, but you must keep version 1.2 for compatibility. You have defined a variable 'lib_version' in the playbook's vars section with value '1.2'. The role's task uses the variable 'libapp_version' (not 'lib_version'). The play fails because 'libapp_version' is undefined. What is the best way to resolve this issue without modifying the role?
⚠ Common exam trap
It's easy for candidates to confuse variable names (lib_version vs libapp_version) and attempt to rename variables or modify role defaults, rather than understanding that the correct solution is to set the exact variable expected by the role at the playbook level.
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
✓
Use the playbook to set libapp_version as a variable for the role: either in the play vars section or by passing it as a role parameter.
It allows you to set the variable `libapp_version` that the role expects without modifying the role itself. By defining `libapp_version` in the playbook's vars section or passing it as a role parameter, you override the role's default value (2.0) with the required version 1.2, ensuring the task uses the correct library version while preserving role integrity.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Modify the role's defaults/main.yml to set libapp_version to 1.2.
Why it's wrong here
Editing defaults/main.yml alters the role itself, which the question forbids, and defaults sit at the lowest precedence so they would not override the play's value anyway. Defaults are the right place for fallback values shipped with a role, not for per-play overrides.
- ✓
Use the playbook to set libapp_version as a variable for the role: either in the play vars section or by passing it as a role parameter.
Why this is correct
The role reads libapp_version, so supplying that exact variable name overrides the role default of 2.0 while leaving the role untouched. Setting it in play vars or as a role parameter satisfies the requirement to keep libapp version 1.2.
- ✗
Rename your playbook variable from lib_version to libapp_version in the play vars.
Why it's wrong here
Renaming the play variable supplies libapp_version, but play vars outrank role defaults only for that play, so the role's 2.0 default is overridden correctly; however the question expects the variable name the role's task actually references, and renaming alone leaves the role's own default untouched for other callers. Extra vars would be the unambiguous override.
- ✗
Create a file roles/web/vars/main.yml with libapp_version: 1.2.
Why it's wrong here
A role vars file loads at higher precedence than defaults, but it still lives inside the role, which the question forbids modifying. Role vars suit values intrinsic to the role's own logic, not a per-play compatibility pin that the caller must control.
Visual reference
Go deeper
Related to this question
About these practice questions
One of 392 original EX294 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
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.