EX294 Manage task execution and roles Practice Question
Exhibit
---
- hosts: webservers
vars:
http_port: 80
tasks:
- name: Ensure Apache is running
service:
name: httpd
state: started
- name: Check if port is open
wait_for:
host: "{{ ansible_facts['default_ipv4']['address'] }}"
port: "{{ http_port }}"
state: started
delegate_to: localhostRefer to the exhibit. An administrator runs the playbook but the wait_for task fails. What is the most likely cause?
⚠ Common exam trap
The EX294 exam often tests the dependency between fact gathering and fact-based variables, trapping candidates who assume the error is a simple type mismatch or misspelling rather than a missing fact collection step.
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
✓
The ansible_facts variable may not be available because fact gathering is disabled.
The playbook uses `ansible_facts['ansible_tcpip_socket']['port']` to supply the port number to the `wait_for` module. If fact gathering is disabled (e.g., via `gather_facts: no` at the play level or `ANSIBLE_GATHERING=explicit`), the `ansible_facts` dictionary is empty, so the variable resolves to `None` or an undefined value, causing the task to fail. The error is not a syntax or type issue but a missing fact dependency.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The ansible_facts variable may not be available because fact gathering is disabled.
Why this is correct
Correct: without gather_facts: yes, ansible_facts is empty.
- ✗
The http_port variable is misspelled.
Why it's wrong here
Incorrect: http_port is defined correctly.
- ✗
The wait_for module requires the 'port' parameter to be an integer.
Why it's wrong here
Incorrect: wait_for accepts strings for port.
- ✗
The delegate_to should be set to the remote host.
Why it's wrong here
Incorrect: delegate_to to localhost is valid for checking port connectivity.
Visual reference
Go deeper
Related to this question
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 →
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.