hardMultiple Select
CCNP Practice Question: Which three statements about Ansible roles and…
Which three statements about Ansible roles and directory structure are true? (Choose three.)
⚠ Common exam trap
The 350-401 exam often tests the misconception that defaults have high precedence, when in fact they are the lowest, and that roles are not reusable, which contradicts their purpose.
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
✓
A role must contain at least a 'tasks' directory with a main.yml file to be functional.
Option A is correct because a role's core behavior lives in its tasks/main.yml file; without a tasks directory containing main.yml, the role has no tasks to execute and is effectively non-functional. Option C is correct because the meta directory's main.yml uses the dependencies key to declare other roles that must run before this role, enabling role composition. Option D is correct because handlers are stored in handlers/main.yml and are only run when a task using the notify directive reports a changed state. Option B is incorrect because variables in defaults/main.yml have the lowest precedence, not the highest, so they are easily overridden. Option E is incorrect because roles are designed for reuse and can be shared across projects via Ansible Galaxy, Git, or collections.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
A role must contain at least a 'tasks' directory with a main.yml file to be functional.
Why this is correct
Ansible loads a role's logic from tasks/main.yml, so a role lacking that directory and file has no tasks to execute and cannot function. This satisfies the statement's requirement, though other directories such as handlers, vars and templates remain optional.
- ✗
Variables defined in the 'defaults' directory of a role have the highest precedence.
Why it's wrong here
Variables in defaults carry the lowest precedence, overridden by inventory, host_vars, group_vars and role vars. It tempts because defaults are role-supplied, suggesting authority, but they exist precisely as easily overridden fallbacks. Highest precedence belongs to extra vars passed at runtime.
- ✓
The 'meta' directory in a role can define dependencies on other roles using the 'dependencies' key.
Why this is correct
The meta directory's main.yml uses the dependencies key to list other roles that must run before this role, so Ansible pulls them in automatically. This satisfies the question's requirement that role dependencies are declared within the role structure itself rather than in the playbook.
- ✓
Handlers in a role are defined in the 'handlers' directory and are triggered by the 'notify' directive in tasks.
Why this is correct
Handlers live in a role's `handlers` directory and run only when a task reports a change and issues `notify`, satisfying the stem's requirement for true statements about role directory structure. This deferred execution avoids restarting services on every playbook run, which is the mechanism that makes the statement accurate.
- ✗
Roles cannot be shared or reused across different Ansible projects.
Why it's wrong here
Roles are explicitly designed for reuse: a role's standardised directory structure lets it be shared across playbooks and projects, including via collections or version control. It tempts because roles are self-contained, which some mistake for project-bound isolation, but portability is their purpose.
About these practice questions
Courseiva writes every 350-401 question from scratch — 1,923 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 Cisco exam blueprint
This 350-401 practice question is part of Courseiva's free Cisco 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 350-401 exam.