300-435 Question 92
Select 2You are tasked with automating the configuration of an IOS XE router using Ansible. Your playbook needs to configure an interface with an IP address and ensure the interface is enabled. Which Ansible module should you use, and what key parameters are required to achieve this?
- A
The 'ios_config' module with parameters specifying the CLI configuration commands
- B
The 'ios_interface' module with parameters for the interface name, IP address, and state
- C
The 'ansible.netcommon.cli_command' module with raw CLI commands for interface configuration
- D
The 'ios_facts' module to gather device facts before configuring the interface
- E
The 'ios_static_routes' module to configure the interface and its IP address
Show answer and explanation
Correct answers: A, B
Explanation
To configure an IOS XE device's interface with an IP address and ensure it is enabled, you can use either the 'ios_config' module (to send raw CLI commands) or the 'ios_interface' module (designed specifically for interface-level tasks). The 'ios_interface' module is the preferred choice due to its simplicity and readability, but 'ios_config' is also valid as it provides flexibility for CLI-based configurations.
- A. Correct.
The 'ios_config' module is used to send raw configuration commands to the device, making it suitable for this task. However, it requires precise CLI commands, which could make the playbook less reusable and harder to maintain.
- B. Correct.
The 'ios_interface' module is specifically designed for interface configuration tasks, including setting the interface name, IP address, and state. It is a higher-level module, making it more Ansible-friendly and easier to use.
- C. Incorrect.
The 'ansible.netcommon.cli_command' module is used for executing arbitrary CLI commands but is not specialized for configuring interfaces. It is less efficient compared to the 'ios_interface' or 'ios_config' modules for this task.
- D. Incorrect.
The 'ios_facts' module is used to collect detailed information (facts) about an IOS device but does not configure interfaces. It is irrelevant for this specific task.
- E. Incorrect.
The 'ios_static_routes' module is used for configuring static routes on IOS devices, not for interface configuration. It is unrelated to the scenario.