Question 268 of 510
Scripting, Containers and AutomationhardMultiple ChoiceObjective-mapped

Quick Answer

The answer is that the `ansible_become_password` variable is not set in the production inventory. This error occurs because Ansible’s privilege escalation method, `sudo`, is waiting for a password prompt that never arrives, even though the user has passwordless sudo configured. When `ansible_become_password` is missing or empty, Ansible still expects a password by default, causing a timeout at the 'Gather Facts' stage. On the CompTIA Linux+ XK0-005 exam, this scenario tests your understanding of Ansible inventory variables and privilege escalation flow—a common trap is assuming passwordless sudo means you can omit the variable entirely, but Ansible’s become mechanism requires explicit configuration. Remember that test and production environments often differ in inventory variable definitions, so always verify that `ansible_become_password` is set, even for passwordless setups. Memory tip: “No password variable means no prompt—just a timeout.”

XK0-005 Scripting, Containers and Automation Practice Question

This XK0-005 practice question tests your understanding of scripting, containers and automation. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

Your organization uses Ansible for configuration management across 500 servers. The management server is a Linux workstation. You have written a playbook to deploy a new monitoring agent. The playbook works on all test machines but fails on production machines at the 'Gather Facts' stage with the error: 'fatal: [server1]: FAILED! => {"msg": "Timed out waiting for privilege escalation prompt: become method 'sudo' requires a password" }'. All production servers have the same sudoers configuration. You have confirmed that the user 'ansible' has passwordless sudo configured correctly. What is the most likely cause?

Clue words in this question

Noticing these words before you look at the options changes how you read each choice.

  • Clue: "most likely"

    Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

Question 1hardmultiple choice
Read the full Ansible explanation →

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_become_password is not set in the inventory

The error indicates that Ansible's privilege escalation (sudo) is prompting for a password, even though the 'ansible' user has passwordless sudo configured. This typically occurs when the 'ansible_become_password' variable is not set or is empty in the inventory, causing Ansible to wait for a password prompt that never comes. Since the playbook works on test machines, the difference is likely that the inventory for production lacks the required 'ansible_become_password' or 'ansible_become' settings, or the variable is not being passed correctly.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

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 production servers have a different SSH key

    Why it's wrong here

    If SSH key were wrong, Ansible would fail at SSH authentication, not at privilege escalation.

  • The SSH timeout is too low

    Why it's wrong here

    The error mentions privilege escalation timeout, not SSH connection timeout.

  • The ansible_become_password is not set in the inventory

    Why this is correct

    Without ansible_become_password, Ansible waits for a password prompt; setting it to empty acknowledges passwordless sudo.

    Clue confirmation

    The clue word "most likely" in the question point toward this answer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The become_user is set incorrectly

    Why it's wrong here

    An incorrect become_user would cause a different error, such as user not found, not a timeout on privilege escalation.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates assume passwordless sudo means no 'become_password' is needed, but Ansible still requires the variable to be explicitly set (even to an empty string) or the 'become' method to be configured correctly to avoid waiting for a prompt.

Detailed technical explanation

How to think about this question

Ansible's privilege escalation uses the 'become' system, which by default expects 'ansible_become_password' to be provided via inventory variables, '--ask-become-pass' CLI flag, or an encrypted vault file. If passwordless sudo is configured but the 'ansible_become_password' variable is set to an empty string or not defined, Ansible will still attempt to send a password and wait for the prompt, leading to a timeout. The 'gather_facts' stage runs before any tasks, so this failure occurs early in the playbook execution.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A junior network technician can log in to a core router but cannot reach the enable prompt or configuration mode. The AAA server is authenticating the login — but the authorisation policy only grants privilege level 1, not 15. Authentication (who you are) is working; authorisation (what you can do) is not.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related XK0-005 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free XK0-005 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this XK0-005 question test?

Scripting, Containers and Automation — This question tests Scripting, Containers and Automation — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: The ansible_become_password is not set in the inventory — The error indicates that Ansible's privilege escalation (sudo) is prompting for a password, even though the 'ansible' user has passwordless sudo configured. This typically occurs when the 'ansible_become_password' variable is not set or is empty in the inventory, causing Ansible to wait for a password prompt that never comes. Since the playbook works on test machines, the difference is likely that the inventory for production lacks the required 'ansible_become_password' or 'ansible_become' settings, or the variable is not being passed correctly.

What should I do if I get this XK0-005 question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Are there clue words in this question I should notice?

Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This XK0-005 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-005 exam.