Red Hat Certified Engineer (RHCE) Exam Prep
Free practice questions

Free RHCE Practice Questions

10 exam-style questions with answers and explanations, straight from our 1,030-question bank. Tap an answer to check yourself. When you're ready, take the scored version in the free practice test.

Start the free practice test → ★★★★★4.9/5 from 2,400+ candidates · No signup

These 10 free RHCE questions are organized by exam domain, so you can see how each part of the Red Hat Certified Engineer (RHCE) blueprint is tested. Reveal the answer and explanation under each question.

Domain 1: Be able to perform all tasks expected of a Red Hat Certified System Administrator

Question 1

httpd returns 403 when serving /srv/reports/status.html on a RHEL server. Apache access directives and ordinary file permissions have been checked and permit access. The audit log records a read denial from httpd_t to a file labeled var_t. A persistent file-context rule for /srv/reports(/.*)? already specifies httpd_sys_content_t, but ls -Z still shows var_t on the existing file. SELinux must remain enforcing. What remains to be done?

Show answer & explanation

Correct answer: A - Run restorecon -Rv /srv/reports to apply the recorded file-context rule.

Question 2

/dev/vgdata/lvdata is a linear logical volume of exactly 6 GiB containing an XFS filesystem mounted at /srv/data. It must grow to exactly 9 GiB while remaining mounted. The volume group has 900 free physical extents of 4 MiB each, with no additional allocation constraints. All required utilities are available, and the growth is authorized. Use 1 GiB = 1,024 MiB. Which command sequence fits the available space and makes the added capacity usable?

Show answer & explanation

Correct answer: A - lvextend -l +768 /dev/vgdata/lvdata && xfs_growfs /srv/data

Domain 2: Understand core components of Ansible

Question 3

A release review includes this completed Ansible recap for one host: app4 : ok=8 changed=2 unreachable=0 failed=0 skipped=1 rescued=1 ignored=0 There are no custom callbacks or modified statistics. What can you conclude from this row alone?

Show answer & explanation

Correct answer: C - A task failure was rescued; the intended application state still needs verification.

Domain 3: Configure Ansible

Question 4

Only production web hosts outside maintenance may receive a deployment. The complete inventory.ini is: [web] edge1 edge2 edge3 [prod] edge2 edge3 db1 [maintenance] edge3 The single play in deploy.yml uses hosts: web. You preview this command: ansible-playbook -i inventory.ini deploy.yml --limit 'prod:!maintenance' --list-hosts Which hosts will be listed?

Show answer & explanation

Correct answer: C - edge2 only

Domain 4: Configure Ansible managed nodes

Question 5

SSH key authentication to db2 succeeds. A raw command run through that same Ansible connection confirms that /usr/bin/python3 exists and is compatible with the installed ansible-core. Nevertheless, a Python-based module fails with: /bin/sh: /usr/bin/python3.11: No such file or directory The host inventory contains: db2 ansible_python_interpreter=/usr/bin/python3.11 No other source overrides that variable. The evidence points to which correction?

Show answer & explanation

Correct answer: A - Set db2's ansible_python_interpreter to /usr/bin/python3.

Domain 5: Create and distribute SSH keys to managed nodes

Question 6

The deploy account must retain exactly two approved SSH public keys and remove every obsolete key. controller_public_key and recovery_public_key each contain a different, valid public-key line. The following task is proposed for a production key rotation: - ansible.posix.authorized_key: user: deploy state: present key: "{{ item }}" exclusive: true loop: - "{{ controller_public_key }}" - "{{ recovery_public_key }}" Which revision preserves both access routes while enforcing the complete approved key set?

Show answer & explanation

Correct answer: B - Pass both keys as one newline-separated key value in a single invocation with exclusive: true.

Domain 9: Perform basic source control operations using Git

Question 7

Before committing a reverse-proxy change, you see: $ git status --short MM site.yml ?? templates/vhost.conf.j2 ?? vault-pass.txt site.yml was staged and then edited again. The saved working-tree version is the one approved for release. The new template must be committed with it, while the plaintext vault-pass.txt must remain untracked. No other files are staged, and all commands will run from the repository root. Choose the command sequence that records exactly the approved content.

Show answer & explanation

Correct answer: B - git add site.yml templates/vhost.conf.j2 && git commit -m 'Configure virtual host'

Domain 11: Create Ansible plays and playbooks

Question 8

An API service is running on TCP 8080. A playbook renders a valid configuration that changes its listener to TCP 8081 and reports changed. The template task notifies a handler named Restart API. The very next task checks http://127.0.0.1:8081/health on the managed host, but fails because the service still uses 8080. The handler has not run. This service completes its restart only after the configured listener is ready. What adjustment makes the health check test the new configuration without restarting an unchanged service on every run?

Show answer & explanation

Correct answer: C - Insert ansible.builtin.meta: flush_handlers between the template task and the health check.

Domain 13: Automate standard RHCSA tasks using Ansible modules that work with:

Question 9

A firewall change must allow HTTPS immediately and after reboot on both existing and newly provisioned RHEL servers. firewalld is running, the client-facing interface uses the public zone, and the HTTPS service definition is correct. An unrelated, approved runtime-only rule must remain temporary and must not be lost during this change. The playbook currently contains: - ansible.posix.firewalld: zone: public service: https state: enabled permanent: true immediate: false How should this task be amended to meet the requirements without replacing the active ruleset?

Show answer & explanation

Correct answer: D - Change immediate to true and keep permanent set to true.

Domain 14: Manage content

Question 10

During a deployment with --diff, a database password appears in the output of an ansible.builtin.template task. The variables file is encrypted with Ansible Vault and was decrypted correctly for this run. The destination is already root-owned with mode '0600'; the application requires its configuration to contain the usable plaintext password. Select the change that suppresses secret-bearing task output and file differences while preserving the required application configuration.

Show answer & explanation

Correct answer: D - Set no_log: true and diff: false on the template task.

The rest of the RHCE blueprint

The RHCE exam also covers these domains. Drill them in the full free practice test:

That's 10 of 1,030

The full bank has 1,020 more RHCE questions with explanations.

Continue in the free practice test →

View plans