Courseiva
easyMultiple ChoiceObjective-mapped

XK0-006 Practice Question: A team uses Ansible for configuration management

A team uses Ansible for configuration management. A playbook fails with the error 'ERROR! Syntax Error while loading YAML script'. Which of the following is the most likely cause?

⚠ Common exam trap

Many candidates confuse a YAML parsing error with a runtime execution error, such as an SSH key issue or an invalid module, because they all prevent the playbook from running successfully.

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

Incorrect indentation in the YAML file

The error 'Syntax Error while loading YAML script' indicates that Ansible's YAML parser encountered a structural problem in the playbook file. The most common cause in YAML is incorrect indentation, because YAML relies on consistent spacing (typically 2 spaces per level) to define the hierarchy of tasks, plays, and variables. A missing SSH key would produce a connection or authentication error, not a YAML syntax error.

Answer analysis

Option-by-option breakdown

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

  • Missing SSH key

    Why it's wrong here

    Would cause a connection error, not a YAML syntax error.

  • Incorrect indentation in the YAML file

    Why this is correct

    YAML syntax errors are most commonly due to indentation mistakes.

  • Invalid module name

    Why it's wrong here

    Invalid module name would produce a 'module not found' error, not a syntax error.

  • Playbook not executable

    Why it's wrong here

    Ansible playbooks do not need to be executable; they are parsed by ansible-playbook.

About these practice questions

Courseiva writes every XK0-006 question from scratch — 979 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.