how to bypass a Cisco menu

I have Ansible playbooks that use the “ios_config” module to backup the config of my Cisco devices. Works fine on all my Ciscos except the terminal servers.

This makes total sense: when I ssh to one of our terminal servers, I don’t get a CLI prompt. Instead, I’m immediately presented with a menu. The menu presents a list of device names, and prompts me for the number of the device I want serial access to. We’ve set up the special menu item number 3 to mean “exit the menu, go to the terminal server’s CLI”. From then on, I can executes Cisco CLI commands just like on the other Ciscos.

So I need Ansible to emit a “3” immediately after connecting. To try to solve this, I have a device group in my inventory file named, “[terminalservers]”. I have a special playbook for this group. It looks like the playbook I use on other Ciscos, except that it has an extra task uses the “raw” module to emit a “3”.

It’s not working. Am I on the right track? I looked at “ios_command” and “shell” and “expect”, but it seems that “raw” is the right module for this. Currently, it just times out on the “raw” module.

Any suggestions are welcome.