XK0-006 Automation, Orchestration, and Scripting Practice Question
A system administrator needs to update a configuration file on multiple servers using Ansible. The playbook must ensure the line 'MaxAuthTries 3' is present in /etc/ssh/sshd_config. Which Ansible module is most appropriate?
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
✓
lineinfile
The lineinfile module ensures a specific line is present in a file, ideal for configuration management.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
template
Why it's wrong here
template is for Jinja2 templating, not for simple line presence.
- ✗
shell
Why it's wrong here
shell runs arbitrary commands but is not idempotent or recommended.
- ✗
copy
Why it's wrong here
copy is for copying files, not for ensuring a line exists in a file.
- ✓
lineinfile
Why this is correct
lineinfile is designed to manage lines in text files.
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.