A platform team must configure forty IOS XE switches from a Linux automation server running Ansible. Each play has to reuse one SSH CLI session per device, gather platform facts with ios_facts, and apply interface descriptions with ios_config using the current cisco.ios collection modules. Which Ansible connection setup meets all three requirements?
Select an answer to reveal the explanation.
Short Explanation
You’ve got the right setup: network_cli with the IOS platform setting lets ios_facts and ios_config use one persistent SSH CLI session. Resetting that connection breaks reuse, while cli_command/cli_config and parsed ios_command output don’t meet the required module choices.
Full Explanation
Use ansible_connection: network_cli with ansible_network_os: cisco.ios.ios, then run ios_facts and ios_config. network_cli maintains a persistent SSH CLI connection, and the platform setting selects the IOS behavior required by the current cisco.ios modules. This combination gathers platform facts with ios_facts and applies interface descriptions with ios_config while reusing one session per device. Resetting the persistent connection between the fact-gathering and configuration plays defeats the session-reuse requirement, even though the platform setting and required modules are otherwise appropriate. Using cli_command for facts and cli_config for descriptions can send CLI commands, but it does not use the specifically required ios_facts and ios_config modules. Gathering show-command output with ios_command and parsing it yourself likewise does not satisfy the ios_facts requirement, although network_cli and ios_config fit the other requirements. Exam caveat: check the installed cisco.ios collection version and confirm that it supports the module names and platform setting you plan to use. Practical check: run the play with increased verbosity and verify that inventory resolves to network_cli and cisco.ios.ios, both specified modules execute, and the persistent connection is not reset between the plays.