Skip to content
Zurück zu den Lernmaterialien

50 Free RHCE Practice Questions (EX294) — Ansible Automation

29. Juli 2026~4 min read

Preparing for RHCE? These 50 questions cover the EX294 Ansible Automation exam.


Core Ansible Components (Questions 1–12)

Question 1

Which directory contains the main Ansible configuration file?

a) /etc/ansible/ansible.cfg
b) ~/ansible.cfg
c) ./ansible.cfg (in project directory)
d) All of the above (precedence order: project > home > /etc)

Show Answer

Answer: d) All of the above (precedence order: project > home > /etc)

Explanation: Ansible reads ansible.cfg in order of precedence: 1) ANSIBLE_CONFIG env var, 2) ./ansible.cfg, 3) ~/.ansible.cfg, 4) /etc/ansible/ansible.cfg.

Question 2

Which Ansible module copies files with Jinja2 template processing?

a) copy
b) template
c) file
d) fetch

Show Answer

Answer: b) template

Explanation: The template module copies a file to the target, processing Jinja2 variables and expressions. The copy module copies files without template processing.

Question 3

Which module manages services on a target system?

a) systemd
b) service
c) systemctl
d) Both a and b

Show Answer

Answer: d) Both a and b

Explanation: The service module works with most init systems. The systemd module is specific to systemd. Both manage service state (started, stopped, restarted, enabled, disabled).

Questions 4–12

[Full set covers inventory files, ansible.cfg, ad-hoc commands, modules (command, shell, copy, file, yum, user, lineinfile, selinux, firewalld)]


Playbooks (Questions 13–27)

Question 4

What does the gather_facts: no directive do in a playbook?

a) Skips the facts gathering step, speeding up playbook execution
b) Removes all variables
c) Disables logging
d) Prevents SSH connections

Show Answer

Answer: a) Skips the facts gathering step, speeding up playbook execution

Explanation: Setting gather_facts: no at the play level skips the setup module, significantly speeding up playbook execution when system facts aren't needed.

Question 5

What is the purpose of the when conditional in Ansible?

a) Defining conditions for task execution
b) Looping over items
c) Setting variables
d) Including files

Show Answer

Answer: a) Defining conditions for task execution

Explanation: The when clause controls whether a task runs based on a condition (e.g., when: ansible_os_family == "RedHat").

Question 6

Which Ansible feature handles errors with block, rescue, and always?

a) Error handling blocks
b) Conditional execution
c) Error recovery
d) Task control

Show Answer

Answer: a) Error handling blocks

Explanation: Block/Rescue/Always works like try/catch/finally. Tasks in block run normally. If any fails, rescue tasks run. always tasks run regardless of success or failure.

Questions 7–27

[Full set covers handlers, tags, loops, block/rescue/always, templates, variables, register, changed_when, failed_when]


Variables, Facts, and Inventories (Questions 28–38)

Question 7

What is the highest variable precedence in Ansible?

a) group_vars/all
b) host_vars/hostname
c) --extra-vars (CLI)
d) vars/main.yml in a role

Show Answer

Answer: c) --extra-vars (CLI)

Explanation: Extra vars (-e) have the highest precedence, overriding all other variable sources. They're followed by role params, set_fact, and registered vars.

Question 8

Which fact contains the operating system family (RedHat, Debian)?

a) ansible_os_family
b) ansible_distribution
c) ansible_system
d) ansible_kernel

Show Answer

Answer: a) ansible_os_family

Explanation: ansible_os_family returns "RedHat" for RHEL/CentOS/Fedora and "Debian" for Debian/Ubuntu. ansible_distribution gives the specific distribution name.

Questions 9–38

[Full set covers fact gathering, custom facts, registered variables, set_fact, group_vars, host_vars, inventory variables, vault]


Roles and Collections (Questions 39–50)

Question 9

Which directories are part of the standard Ansible role structure?

a) tasks, handlers, templates, files, vars, defaults, meta
b) tasks, handlers, templates, roles
c) playbooks, roles, inventory
d) src, dest, config

Show Answer

Answer: a) tasks, handlers, templates, files, vars, defaults, meta

Explanation: Standard role directories: tasks (main tasks), handlers (notify handlers), templates (Jinja2 templates), files (static files), vars (high-precedence vars), defaults (low-precedence vars), meta (dependencies, author info).

Question 10

Which command installs a role from Ansible Galaxy?

a) ansible-galaxy role install geerlingguy.apache
b) ansible-galaxy install geerlingguy.apache
c) ansible-install geerlingguy.apache
d) ansible role add geerlingguy.apache

Show Answer

Answer: b) ansible-galaxy install geerlingguy.apache

Explanation: ansible-galaxy install <namespace.role> downloads roles from Ansible Galaxy. Use -r requirements.yml to install multiple roles from a file.

Questions 11–50

[Full set covers role creation, dependencies, Galaxy, collections, ansible.builtin, RH-managed roles]


How Did You Score?

Access all RHCE practice questions →

Bereit, dein Wissen zu testen?

Probiere unsere Übungsprüfungen mit Hunderten von realistischen Fragen aus.

Üben starten →

This site uses essential cookies for Stripe payments. No tracking cookies.