What the Ansible ios_facts module gathers from IOS

300-435 By islever Editorial Last updated

Short answer

A The ios_facts module gathers structured hardware, software, interface and routing facts from the IOS device into ansible_facts without changing device state.

Question

What does ios_facts module do?
  1. Gathers structured facts from IOS Correct Answer
  2. Configures interfaces
  3. Reboots
  4. Backup

Key Takeaways

The Ansible ios_facts module collects structured hardware, software, interface and routing facts from a Cisco IOS device and returns them under ansible_facts. Option A is correct because the module is read-only, issuing show commands and parsing the output. It does not configure interfaces, reboot the device, or back up configuration, which are tasks for ios_config or ios_command.

Expert Analysis

Collects hardware, software, interfaces, routing facts.

The deciding mechanism here is Ansible's ios_facts module, which is part of the cisco.ios collection and is invoked against an IOS device over SSH using the ios_connection plugins. When the task runs, Ansible executes the equivalent of show version, show inventory, show ip interface brief, and related show commands, then parses the output into structured host variables returned under ansible_facts. That returned structure is what option A, "Gathers structured facts from IOS", describes, and it is the module's only job.

Option A holds because gathering is a read-only collection operation: the module never writes to the device, and the values it returns (hardware model, software version, interface names and states, routing protocol data) are exactly what a later task would consume as ansible_facts["ansible_net_interfaces"] or ansible_facts["ansible_net_version"]. In a Day-0 or configuration-management workflow, ios_facts runs first precisely so subsequent Jinja2 templates or ios_config tasks can branch on facts such as whether a BGP process already exists.

Option B fails on the write-versus-read distinction: configuring interfaces is the role of ios_config (or ios_l2_l3), which issues interface mode commands and can commit them with save_when. ios_facts has no parameter that issues configuration commands, so interface configuration is outside its contract.

Option C fails for the same reason: a reboot would be issued through ios_command with reload, or through ios_config with a restart style command, not through a facts module. ios_facts runs its show commands and exits without touching device state.

Option D fails because configuration backup is a distinct action performed by ios_config with the backup: yes option, which writes timestamped copies of the running configuration to the control node; alternatively, an ios_command task running show running-config with a local redirect achieves the same. ios_facts does not retrieve or store configuration text as a backup artifact.

One mechanism this question relies on but never states: Ansible fact modules return data under the reserved ansible_facts namespace, and by default those facts are merged into hostvars for every subsequent play on that host. So a single ios_facts task effectively broadcasts hardware, software, interface and routing data to every later task in the play without re-querying the device. That is why option A is the correct description and why B, C and D each describe an action the module simply does not perform.

Official Reference

https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios_facts_module.html

This link opens the official vendor documentation in a new tab.

Exam Strategy

When a question names an Ansible module and asks what it does, classify it by read-versus-write behavior before reading the options. Facts modules (ios_facts, *_info) are read-only and return data; config modules (ios_config) write to the device; command modules (ios_command) execute arbitrary show or exec commands. Apply that split and you can eliminate reboot and backup distractors in seconds, then confirm the surviving option matches the module's gathering role.

Practice All 300-435 Questions

Access 150 questions with complete answers and detailed explanations.

View Full 300-435 Practice Test →

← Back to 300-435 Study Guide