Courseiva

EX294 Implement advanced Ansible automation Practice Question

An administrator wants to reuse a set of tasks that configure a firewall across multiple playbooks. Which Ansible feature should be used to achieve this?

⚠ Common exam trap

It's easy for candidates to confuse roles with other reusable components like variables or handlers, leading candidates to think that storing tasks in a vars file or using handlers can achieve the same cross-playbook reuse.

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

✓

Create a role for firewall configuration.

A role is the correct Ansible feature for reusing a set of tasks across multiple playbooks. Roles provide a structured, self-contained directory layout for tasks, handlers, variables, templates, and files, allowing the firewall configuration logic to be packaged once and referenced in any playbook via the `roles:` directive or `import_role`/`include_role` modules.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Create a role for firewall configuration.

    Why this is correct

    Roles bundle tasks, handlers, defaults and templates into a reusable, structured unit that playbooks can invoke via the roles keyword or include_role. This satisfies the requirement to reuse firewall configuration tasks across multiple playbooks without duplication.

  • ✗

    Add the tasks to the inventory file under a group.

    Why it's wrong here

    Inventory files hold hostnames, groups and connection variables, not executable task lists, so no tasks can run from them. It is tempting because group_vars and host_vars files do sit alongside inventory and supply per-host data, which is the right approach when you need to vary values rather than reuse logic.

  • ✗

    Define the tasks in a vars file and include it.

    Why it's wrong here

    A vars file holds variables, not tasks, so including it injects no reusable task list. It is tempting because vars files are shared across playbooks; they would be correct for parameterising values, whereas reusable tasks require a task file or role.

  • ✗

    Define the tasks as handlers and notify them.

    Why it's wrong here

    Handlers only execute when a task reports changed and notifies them, so they cannot be invoked unconditionally across playbooks. They are tempting because they genuinely share task definitions, and would be correct for restarting a service once after configuration changes, not for always running firewall setup.

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.