EX294 Manage task execution and roles Practice Question
An administrator has a requirements.yml file specifying roles from multiple sources: a public Galaxy server, a private Git repository, and a local path. They want to install all roles into the roles directory of the current project. Which command will achieve this?
⚠ Common exam trap
EX294 often tests the distinction between 'ansible-galaxy install' and 'ansible-galaxy collection install', and the correct use of '--roles-path' versus '-p' with the right directory, causing candidates to choose commands that install to the wrong location.
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
✓
ansible-galaxy install -r requirements.yml --roles-path ./roles
The command 'ansible-galaxy install -r requirements.yml --roles-path ./roles' installs roles from a requirements file into the specified roles directory. The '--roles-path' option (or '-p') sets the destination, and '-r' specifies the requirements file. This meets the requirement to install all roles into the roles directory of the current project.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
ansible-galaxy collection install -r requirements.yml
Why it's wrong here
The collection subcommand reads requirements.yml expecting a collections key, so a roles-only file yields nothing installed. It is tempting because requirements.yml serves both role and collection installs; it would be correct only if the file listed collections rather than roles from Galaxy, Git and a local path.
- ✓
ansible-galaxy install -r requirements.yml --roles-path ./roles
Why this is correct
The `-r` flag reads every entry in requirements.yml, resolving Galaxy, Git and local sources in one pass, while `--roles-path ./roles` overrides the default install location so roles land in the project's own roles directory rather than the user-level path — satisfying the stem's requirement to install all roles locally.
- ✗
ansible-galaxy install -r requirements.yml -p .
Why it's wrong here
The -p flag sets the role installation path, but '.' resolves to the project root, not its roles subdirectory, so roles land in the wrong location. It is tempting because -p is the correct flag for customising install location, and it would work if roles were wanted directly in the project root.
- ✗
ansible-galaxy role install --force -r requirements.yml
Why it's wrong here
The --force flag reinstalls roles that already exist, but it does not change the source resolution or install path. It is tempting because --force is used when roles are present but stale; here the requirement is simply installing all roles from the mixed sources into the project's roles directory, which the plain install command already does.
Go deeper
Related to this question
About these practice questions
Courseiva writes every EX294 question from scratch — 392 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
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.