mediumMultiple Choice
350-401 Practice Question: Given the following Ansible playbook snippet: ---…
Given the following Ansible playbook snippet: --- - name: Configure OSPF hosts: routers gather_facts: no tasks: - name: OSPF config ios_config: lines: - router ospf 1 - network 10.0.0.0 0.255.255.255 area 0 parents: router ospf 1 What is wrong with this playbook?
⚠ Common exam trap
Cisco often tests the misconception that the `parents` parameter is optional or redundant when the mode entry command is already in `lines`, but in reality, it causes a duplicate command error because the module enters the parent mode first.
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 'parents' parameter should not be used with 'router ospf 1' in lines; it causes a configuration error.
The `parents` parameter in the `ios_config` module specifies the parent configuration mode under which the `lines` should be applied. When `lines` already includes `router ospf 1`, using `parents: router ospf 1` causes Ansible to attempt entering the OSPF router configuration mode twice, leading to a configuration error. The correct approach is to either omit the `parents` parameter or include only the network statement in `lines` with the appropriate parent.
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 'parents' parameter should not be used with 'router ospf 1' in lines; it causes a configuration error.
Why this is correct
In Ansible's ios_config module, the `parents` parameter specifies the configuration mode to enter before applying `lines`. When `parents` is set to 'router ospf 1', the module already issues that command to navigate into OSPF configuration mode. Adding `router ospf 1` again inside the `lines` list results in a nested command that the Cisco IOS parser does not accept in this context, producing a configuration error. The correct usage is to place only OSPF subcommands, such as network statements, in `lines` and let `parents` handle the mode entry.
- ✗
The network statement uses a wildcard mask instead of subnet mask, which is incorrect.
Why it's wrong here
The claim that using a wildcard mask instead of a subnet mask is incorrect misunderstands OSPF syntax. OSPF network statements require a wildcard mask, which is the inverse of the subnet mask, and `0.255.255.255` is a valid wildcard mask that matches all addresses with the same first octet. This is exactly how OSPF identifies interfaces to include in the routing process. Therefore, the playbook's use of `0.255.255.255` is syntactically correct and not a source of any error.
- ✗
The OSPF process ID must be 1, but it can be any number.
Why it's wrong here
The statement that the OSPF process ID must be 1 is false because the process ID is a locally significant value that can be any integer between 1 and 65535, depending on the platform. While 1 is a common choice and perfectly acceptable, there is no requirement that it be 1; the playbook does not depend on a specific process ID for correctness. Thus, this is not a valid reason to claim the playbook contains an error.
- ✗
There is no error; the playbook works correctly.
Why it's wrong here
The assertion that the playbook works correctly is incorrect because the combination of the `parents` parameter and the `router ospf 1` line causes a genuine configuration failure. In Cisco IOS, `router ospf 1` is a global configuration command, not a valid subcommand within OSPF router configuration mode. When Ansible applies the `lines` list after `parents` has already entered that mode, the redundant command is rejected by the CLI parser, and the task returns an error. The playbook would succeed only if the `router ospf 1` line were removed from `lines`, leaving just the OSPF-specific subcommands.
Visual reference
Quick reference
Routing Protocol Comparison
| Protocol | Metric | Max Hops | Algorithm | Type |
|---|---|---|---|---|
| RIP v2 | Hop count | 15 | Bellman-Ford | Distance vector |
| OSPF | Cost (bandwidth) | Unlimited | Dijkstra (SPF) | Link state |
| EIGRP | Composite metric | Unlimited | DUAL | Hybrid |
| IS-IS | Cost | Unlimited | Dijkstra | Link state |
| BGP | Policy / attributes | Unlimited | Path vector | Path vector |
RIP's 15-hop limit makes it unsuitable for large networks. OSPF and EIGRP dominate modern enterprise deployments.
Go deeper
Related to this question
Learn chapter
EIGRP: Basics and Advanced Configuration
Key term
Ansible for Network Automation
Ansible for Network Automation is an open-source tool that allows network engineers to automate the configuration, management, and deployment of network devices like routers and switches using simple text files instead of manual commands.
About these practice questions
This 350-401 question is part of Courseiva's 1,923-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 350-401 practice question is part of Courseiva's free Cisco 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 350-401 exam.