RHCE Ansible Roles and Collections Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Thames
T
Thames
Community Contributor
Quizzes Created: 11982 | Total Attempts: 187,298
| Questions: 20 | Updated: Aug 16, 2026
Please wait...
Question 1 / 21
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. Which of the following is a valid namespace for a collection?

Explanation

A collection’s fully qualified name uses the format `namespace.collection`. `ansible.builtin`, `community.general`, and `amazon.aws` are all valid collection names, so each is a valid namespace-and-collection identifier.

Submit
Please wait...
About This Quiz
RHCE Ansible Roles and Collections Quiz - Quiz

This quiz evaluates your understanding of Ansible roles and collections, core components of enterprise automation. Learn how to structure reusable playbooks, manage dependencies, and leverage community-contributed collections for complex infrastructure tasks. Perfect for RHCE candidates preparing for Red Hat certification.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. Which statement about role scope is correct?

Explanation

In Ansible, role defaults are designed to be easily overridden, so playbook variables take precedence over them. Within a role, variables defined in the `vars/` directory have higher precedence than those in `defaults/`. Therefore, both statements describe the variable precedence order correctly.

Submit

3. The files/ directory in a role stores ____.

Explanation

In an Ansible role, the `files/` directory contains static files that tasks may distribute to managed hosts. These can include scripts, certificates, archives, or other unchanged assets. Ansible commonly locates them relative to the role and copies them with the `copy` module; unlike templates, their contents are not rendered with variables.

Submit

4. When using collections, how do you access plugins not explicitly imported?

Explanation

Collection plugins can be used without explicitly importing them because Ansible discovers them through the collection system. You can refer to a plugin by its fully qualified name, such as `namespace.collection.plugin_type.plugin_name`, or configure a `collections` list at the playbook or play level so Ansible searches the specified collections for unqualified plugin names.

Submit

5. What is the purpose of the templates/ directory in a role?

Explanation

The `templates/` directory holds Jinja2 template files that Ansible processes to generate configuration files dynamically. Templates can use variables and logic, allowing the resulting files to be customized for each host or environment.

Submit

6. In Ansible, a role can include other roles through the ____.

Explanation

Ansible roles can declare dependencies in `meta/main.yml`. The `dependencies` section lists other roles that Ansible should run before the current role, allowing roles to reuse and build on one another.

Submit

7. Which command installs a specific version of a collection?

Explanation

Use `ansible-galaxy collection install namespace.name:version` to install a collection at a specified version. The namespace and collection name identify the collection, while the version after the colon selects the release to install.

Submit

8. What is the execution order when a playbook calls a role?

Explanation

A role’s task files execute when the role is applied in a play. Its handlers do not run automatically; a task must notify a handler, and the handler runs later, typically at the end of the play. This avoids unnecessary work when the task’s change does not require the handler’s action.

Submit

9. The handlers/ directory in a role is used for ____.

Explanation

The `handlers/` directory in an Ansible role contains handler tasks. These tasks run only when notified by another task, usually after a change occurs. Handlers are commonly used for actions such as restarting or reloading a service after its configuration has been updated.

Submit

10. To use a module from a specific collection, what syntax is required?

Explanation

Use the fully qualified collection name, `collection_namespace.collection_name.module_name`, to specify the module’s namespace, collection, and module name. This tells the system exactly where to find the module and avoids ambiguity with modules that share a name.

Submit

11. What is the primary purpose of an Ansible role?

Explanation

An Ansible role groups related tasks, variables, handlers, templates, and files into a standardized structure. This makes automation easier to reuse, share, maintain, and organize across different playbooks and projects.

Submit

12. The vars/ directory in a role contains variables with ____.

Explanation

In Ansible, a role’s `vars/` directory holds variables associated with that role. These variables have high precedence in Ansible’s variable order, so they override role defaults and many inventory or play-level values. However, sources with higher precedence, such as extra variables passed on the command line, can still override them.

Submit

13. How can you specify required collections in a project?

Explanation

Project collection dependencies are declared in a `requirements.yml` file or in the project’s `galaxy.yml` metadata. These files list the collections and, optionally, their versions, allowing Ansible Galaxy tools to install or manage them consistently for the project.

Submit

14. What does the meta/main.yml file in a role contain?

Explanation

The `meta/main.yml` file defines information about an Ansible role, including its metadata, dependencies on other roles, and supported platforms. Ansible uses this information to understand the role’s requirements and compatibility.

Submit

15. The ansible-galaxy command is used to ____.

Explanation

The `ansible-galaxy` command helps manage Ansible roles and collections. It can install them from Ansible Galaxy or other sources, create new ones, and list or remove them, making it easier to organize and reuse automation content across projects.

Submit

16. Where are Ansible collections typically installed?

Explanation

Ansible typically installs collections in the current user’s home directory under `~/.ansible/collections/ansible_collections/`. Collections are organized there by namespace and collection name, making them available to that user without requiring system-wide installation. Other locations can be configured, but this is the standard default path.

Submit

17. Which file specifies a role's dependencies on other roles?

Explanation

In Ansible, a role declares dependencies on other roles in its `meta/main.yml` file, typically under the `dependencies` section. Ansible processes these dependencies before running the role that requires them, helping ensure prerequisite roles are applied first.

Submit

18. What is an Ansible collection?

Explanation

An Ansible collection packages related automation content—such as roles, modules, plugins, and playbooks—into a reusable, versioned distribution that can be shared and installed.

Submit

19. In an Ansible role, the defaults/ directory is used to define ____.

Explanation

The `defaults/` directory in an Ansible role contains default variable values. These have the lowest variable precedence, so they can be easily overridden by inventory, playbook, or other higher-precedence settings.

Submit

20. Which directory structure is required for a valid Ansible role?

Explanation

A conventional Ansible role organizes content into these directories: `tasks/` defines actions, `handlers/` contains notified actions, `templates/` stores Jinja templates, and `files/` holds static assets. `vars/` and `defaults/` provide role variables at different precedence levels, while `meta/` contains role metadata and dependencies. Some directories may be empty or omitted when unused.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following is a valid namespace for a collection?
Which statement about role scope is correct?
The files/ directory in a role stores ____.
When using collections, how do you access plugins not explicitly...
What is the purpose of the templates/ directory in a role?
In Ansible, a role can include other roles through the ____.
Which command installs a specific version of a collection?
What is the execution order when a playbook calls a role?
The handlers/ directory in a role is used for ____.
To use a module from a specific collection, what syntax is required?
What is the primary purpose of an Ansible role?
The vars/ directory in a role contains variables with ____.
How can you specify required collections in a project?
What does the meta/main.yml file in a role contain?
The ansible-galaxy command is used to ____.
Where are Ansible collections typically installed?
Which file specifies a role's dependencies on other roles?
What is an Ansible collection?
In an Ansible role, the defaults/ directory is used to define ____.
Which directory structure is required for a valid Ansible role?
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!