Courseiva

EX294 Implement advanced Ansible automation Practice Question

A playbook must execute a task on a host that is not part of the inventory, such as a temporary cloud instance. The task should run on that host without modifying the inventory file. Which directive should be used?

⚠ Common exam trap

Many candidates confuse delegate_to with add_host. delegate_to requires the host to already exist in the inventory, while add_host creates the host entry dynamically.

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

✓

add_host

The add_host module is designed to add hosts to the in-memory inventory at runtime, enabling tasks to run on hosts not present in the static inventory. Other directives like delegate_to, local_action, and include_vars serve different purposes and do not add hosts.

Answer analysis

Option-by-option breakdown

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

  • ✓

    add_host

    Why this is correct

    The add_host module dynamically adds a host to the in-memory inventory during playbook execution. It allows you to target a host that is not in the static inventory, and subsequent plays can use it. This meets the requirement without editing the inventory file.

  • ✗

    local_action

    Why it's wrong here

    local_action runs the task on the control node, not on a remote host. It is equivalent to delegate_to: localhost. It cannot execute tasks on an external host that is not in the inventory. Therefore, it does not meet the requirement.

  • ✗

    delegate_to

    Why it's wrong here

    delegate_to runs a task on a different host, but that host must already be in the inventory. It does not add new hosts. If the target host is not in the inventory, delegate_to will fail because Ansible cannot resolve connection details. Thus, it does not fulfill the requirement.

  • ✗

    include_vars

    Why it's wrong here

    include_vars loads variables from files, not hosts. It has nothing to do with adding hosts to the inventory or targeting new hosts. It is used to dynamically include variable files during playbook execution, so it is irrelevant here.

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 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.