RHCE Ansible Troubleshooting Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Thames
T
Thames
Community Contributor
Quizzes Created: 11982 | Total Attempts: 187,298
| Questions: 20 | Updated: Aug 16, 2026
Please wait...
Question 1 / 21
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. You receive the error 'No module named 'jinja2'.' How do you resolve this?

Explanation

The error means Python cannot find the Jinja2 library, which is required by the code or tool being run. Install it in the active Python environment with `pip install jinja2`. If you use a virtual environment, activate it first so Jinja2 is available to the correct interpreter.

Submit
Please wait...
About This Quiz
RHCE Ansible Troubleshooting Quiz - Quiz

This quiz evaluates your ability to diagnose and resolve common Ansible issues in Red Hat environments. It covers playbook debugging, inventory configuration, module errors, and host connectivity problems. Perfect for RHCE candidates preparing for hands-on troubleshooting scenarios in production systems.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. You need to see which tasks will run without executing them. Which command previews the execution plan?

Explanation

The `--list-tasks` option displays the tasks defined in a playbook without executing them, letting you inspect what would run before starting the play.

Submit

3. A handler never executes after a task notifies it. What is the most likely cause?

Explanation

Handlers run only when a task’s `notify` value exactly matches the handler’s name. If the names differ, Ansible cannot associate the notification with that handler, so it never executes.

Submit

4. You receive 'ERROR! Unexpected Exception: name 'undefined_var' is not defined.' How do you fix this?

Explanation

This error occurs because the template references a variable that has not been defined. Applying Jinja’s `default` filter supplies a fallback value when the variable is missing, preventing the undefined-variable exception and allowing the template to render. Restarting Ansible or changing the inventory will not help unless they define that variable.

Submit

5. A playbook fails because the ansible_user variable is not set for a group. Where should you define it?

Explanation

Define `ansible_user` in the group’s inventory variables or in `group_vars/`. This makes the connection user available to all hosts in that group and keeps host-specific configuration separate from playbook tasks and global Ansible settings.

Submit

6. You need to skip a task conditionally. Which keyword allows you to skip based on a condition?

Explanation

The `when: condition` keyword controls whether a task runs. If the condition evaluates to false, the task is skipped; if it evaluates to true, the task runs. This allows tasks to be skipped conditionally.

Submit

7. A task uses a Jinja2 filter but returns an error. What is the first troubleshooting step?

Explanation

Check that the Jinja2 filter is written correctly and that the variable it uses exists and has a value. These are the most common causes of filter-related task errors and should be ruled out before changing Ansible settings or modules.

Submit

8. Your playbook fails because a file path contains spaces and is not quoted. Where should you quote the path?

Explanation

Quote the path directly in the YAML task definition so the spaces are treated as part of a single path value rather than separating or confusing the task’s arguments. The inventory, Ansible configuration, and `become_user` settings do not control how this task path is parsed.

Submit

9. When debugging a loop, you want to see each iteration's value. Which keyword displays the loop variable?

Explanation

In Ansible, the `debug` module can display a loop variable either with `var=item` or by interpolating it in a message using `msg='{{ item }}'`. Both forms show the value of `item` for the current iteration.

Submit

10. A playbook task times out while waiting for a service to start. Which parameter adjusts the timeout?

Explanation

In an Ansible playbook, `timeout` sets how long a task or wait operation allows a service to become available before failing. For an asynchronous task, `async_val` (the `async` value) specifies its maximum runtime. These parameters adjust the task’s time limit, unlike retry or connection settings.

Submit

11. You run an Ansible playbook and receive the error 'fatal: [host1]: UNREACHABLE! All retries exhausted.' What is the most common cause?

Explanation

Ansible must establish a connection to the target host before it can run tasks. If SSH is unavailable, the host address or port is incorrect, or the supplied credentials or SSH key are rejected, connection attempts may fail until retries are exhausted. Check network access, SSH settings, and authentication details first.

Submit

12. A module fails with 'localhost is not a valid hostname.' What is the likely cause?

Explanation

Ansible may try to connect to `localhost` using its default SSH transport, which can reject the hostname in this context. Setting `ansible_connection=local` tells Ansible to run the module directly on the control machine instead of connecting over SSH.

Submit

13. Your playbook uses a registered variable from a previous task. The variable appears empty. What should you check first?

Explanation

A registered variable contains the output of the task that created it. If it appears empty, first confirm that task ran successfully and inspect its stdout to see whether it produced the expected output.

Submit

14. A host is not being targeted by your playbook. You suspect an inventory issue. How do you list all hosts matching a pattern?

Explanation

`ansible all -i inventory.ini --list-hosts` uses the `all` host pattern to select every host defined in `inventory.ini`. The `--list-hosts` option displays the matched hosts without running any tasks, making it useful for checking whether the inventory contains the host you expect.

Submit

15. You need to test a playbook without making actual changes. Which flag enables check mode?

Explanation

The `--check` flag runs the playbook in check mode, showing which changes would be made without applying them. This lets you review the playbook’s effects safely before making actual changes.

Submit

16. A module reports 'Permission denied' when executing a command. What is the most likely solution?

Explanation

The command likely requires privileges that the remote account does not have. Add `become: yes` to enable privilege escalation, and set `become_user` to the account that should run the task, such as `root`. This grants the required permissions without changing the connection method or SSH credentials.

Submit

17. Your inventory file syntax is invalid. Which command checks inventory syntax without running tasks?

Explanation

`ansible-inventory --list` loads and parses the inventory, displaying its hosts and groups as JSON. If the inventory syntax is invalid, Ansible reports an error without running any tasks. `ansible-playbook --syntax-check` checks playbook syntax instead.

Submit

18. A task fails because a variable is undefined. How do you prevent the playbook from stopping at that error?

Explanation

Adding `ignore_errors: yes` to the task tells Ansible to continue playbook execution even if that task fails because a variable is undefined. It does not define or fix the variable; it simply prevents the error from stopping subsequent tasks.

Submit

19. Which flag enables verbose debugging output in Ansible to troubleshoot module execution?

Explanation

Ansible’s verbosity options increase the detail shown during playbook execution: `-v` provides additional information, while `-vv` and `-vvv` reveal progressively more diagnostic output. Add one of these flags to the `ansible-playbook` command to inspect task and module execution when troubleshooting.

Submit

20. Your playbook fails with 'ERROR! The field 'tasks' has an invalid value.' What likely caused this?

Explanation

The error indicates Ansible cannot parse the playbook’s task structure. A YAML syntax mistake or incorrect indentation can make the `tasks` field invalid, preventing the playbook from loading before any tasks run.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
You receive the error 'No module named 'jinja2'.' How do you resolve...
You need to see which tasks will run without executing them. Which...
A handler never executes after a task notifies it. What is the most...
You receive 'ERROR! Unexpected Exception: name 'undefined_var' is not...
A playbook fails because the ansible_user variable is not set for a...
You need to skip a task conditionally. Which keyword allows you to...
A task uses a Jinja2 filter but returns an error. What is the first...
Your playbook fails because a file path contains spaces and is not...
When debugging a loop, you want to see each iteration's value. Which...
A playbook task times out while waiting for a service to start. Which...
You run an Ansible playbook and receive the error 'fatal: [host1]:...
A module fails with 'localhost is not a valid hostname.' What is the...
Your playbook uses a registered variable from a previous task. The...
A host is not being targeted by your playbook. You suspect an...
You need to test a playbook without making actual changes. Which flag...
A module reports 'Permission denied' when executing a command. What is...
Your inventory file syntax is invalid. Which command checks inventory...
A task fails because a variable is undefined. How do you prevent the...
Which flag enables verbose debugging output in Ansible to troubleshoot...
Your playbook fails with 'ERROR! The field 'tasks' has an invalid...
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!