Courseiva

EX294 Manage inventories and credentials Practice Question

Which THREE of the following are valid ways to define host variables in an Ansible inventory? (Choose exactly three.)

⚠ Common exam trap

Candidates often confuse runtime variable injection methods (like extra_vars or credentials) with static inventory variable definitions, leading them to select options that are valid for passing variables but not for defining host variables in an inventory.

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

✓

Inline in the inventory file, e.g., 'myhost ansible_host=192.168.1.1 http_port=8080'.

Ansible allows inline host variable definitions directly in the inventory file using key=value pairs after the hostname. This is a standard syntax where variables like 'http_port=8080' are assigned to the host 'myhost' and become available as Ansible facts during playbook execution. The 'ansible_host' special variable is also defined this way to override the connection address.

Answer analysis

Option-by-option breakdown

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

  • ✗

    In the 'extra_vars' field of the job template.

    Why it's wrong here

    Extra_vars are runtime overrides, not inventory definition.

  • ✓

    Inline in the inventory file, e.g., 'myhost ansible_host=192.168.1.1 http_port=8080'.

    Why this is correct

    Variables can be assigned directly in the inventory file.

  • ✗

    In a credential's 'Input Configuration' as a secret variable.

    Why it's wrong here

    Credentials define authentication, not host variables.

  • ✓

    In a 'group_vars/<groupname>' file, if the host belongs to that group.

    Why this is correct

    Group variables are inherited by hosts in the group.

  • ✓

    In a 'host_vars/<hostname>' file within the project.

    Why this is correct

    Standard Ansible method for per-host variables.

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.