easyMultiple ChoiceObjective-mapped
XK0-006 Practice Question: Use Ansible to ensure that the `httpd` package is…
An administrator wants to use Ansible to ensure that the `httpd` package is installed on all managed nodes. Which Ansible module should be used?
⚠ Common exam trap
A common mix-up: candidates confuse the `service` module (which manages service state) with package installation, or mistakenly think the `command` module is acceptable for package management despite its lack of idempotency and error handling.
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
✓
yum
The `yum` module is the correct choice because it is a dedicated Ansible module for managing packages on Red Hat-based systems using the YUM package manager. It ensures the `httpd` package is installed by setting the `state: present` parameter, and it handles idempotency by checking the package status before making changes.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
copy
Why it's wrong here
The copy module copies files to remote hosts.
- ✗
command
Why it's wrong here
The command module executes arbitrary commands but is not idempotent and not recommended for package management.
- ✓
yum
Why this is correct
The yum module installs, removes, or upgrades packages using the yum package manager.
- ✗
service
Why it's wrong here
The service module manages the state of a service, not package installation.
Go deeper
Related to this question
About these practice questions
This XK0-006 question is part of Courseiva's 979-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 XK0-006 practice question is part of Courseiva's free CompTIA 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 XK0-006 exam.