Courseiva

XK0-006 Automation, Orchestration, and Scripting Practice Question

An Ansible playbook is being written to install the Nginx web server on a group of Ubuntu servers. Which module should be used in the playbook to install the package?

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

✓

apt

The apt module is used for package management on Debian/Ubuntu systems.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    apt

    Why this is correct

    The apt module drives Ubuntu's native package manager, satisfying the stem's requirement to install Nginx on Debian-based hosts. It handles repository metadata, dependency resolution and idempotent state checks directly, unlike generic command or shell modules that would bypass package management and lose idempotence.

  • ✗

    command

    Why it's wrong here

    The command module runs arbitrary shell commands without package-manager awareness, so it reports changed on every run and cannot verify installed state idempotently. It is tempting for quick one-off execution, but installing Nginx on Ubuntu requires apt, which the apt module wraps with idempotent state handling.

  • ✗

    package

    Why it's wrong here

    The package module is a generic wrapper that requires the underlying package manager to be auto-detected and does not expose apt-specific options such as update_cache or deb configuration. It is tempting for cross-distribution playbooks, but where the target is explicitly Ubuntu, the apt module is the precise choice.

  • ✗

    yum

    Why it's wrong here

    The yum module manages packages through the RPM/yum stack, which Ubuntu does not use; it would fail against dpkg-based systems. It is tempting because yum is the standard package module for RHEL-family hosts, and would be correct when targeting CentOS, Rocky Linux or Fedora rather than Ubuntu.

About these practice questions

This XK0-006 question is part of Courseiva's 781-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 →

How Courseiva writes practice questions · Editorial policy

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.