Courseiva

EX294 Implement advanced Ansible automation Practice Question

An organization uses separate network hops that require different SSH usernames for different inventory groups. Which Ansible configuration approach ensures each group uses the correct SSH user without duplicating playbooks?

⚠ Common exam trap

The trap is thinking ansible.cfg or playbook vars can scope connection settings per group; the exam tests whether you know that group_vars is the correct precedence layer for group-specific SSH users.

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 group_vars directory with a file named after the group containing ansible_user.

Group variables in Ansible are defined in group_vars/<group_name>.yml, and variables set there apply to all hosts in that group. Placing ansible_user in a group-specific file ensures each inventory group uses its correct SSH username without duplicating playbook logic. This is the idiomatic Ansible way to scope connection variables per group.

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 group_vars directory with a file named after the group containing ansible_user.

    Why this is correct

    Group variables are loaded automatically for hosts in the matching group, so placing ansible_user in group_vars/<group>.yml supplies the correct SSH username per inventory group. One playbook then runs against all groups without hard-coded credentials or duplication.

  • ✗

    Specify the SSH user in the inventory file for each host.

    Why it's wrong here

    Per-host ansible_user entries work, but they must be repeated for every host and diverge from group-based inventory structure, so scaling or regrouping forces edits across many lines. It suits small static inventories where hosts genuinely differ individually, not grouped hops sharing one credential.

  • ✗

    Set the ansible_user variable in ansible.cfg.

    Why it's wrong here

    ansible.cfg sets one global remote_user for every connection, overriding per-group needs and breaking hosts on the other hop. It is correct for uniform environments sharing a single SSH account, not for inventories whose groups authenticate with distinct usernames.

  • ✗

    Define ansible_user in the playbook using vars.

    Why it's wrong here

    Playbook vars apply one ansible_user to all hosts in the play, so groups needing different SSH usernames cannot be distinguished without separate plays or includes. It fits single-credential environments; group_vars directories keyed to inventory groups are what vary credentials per hop.

About these practice questions

Courseiva writes every EX294 question from scratch — 392 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 →

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.