How to copy very long(5000+ lines) out-put of commands to files

Hello Team,

I am using ios_command module in a playbook. With this module we executes different commands (i.e. show version, show ISIS neighbor, show users etc…) on routers and collect respective output in text file. To copy out-put in a text file we use “copy” module. And whole playbook executed properly for all 58 commands except 2 commands.

These 2 commands have very long((5000+ lines)) output. Because of this playbook didn’t return output of these two commands.

Can anyone support me to collect very long output in a text file.

I am playing with the following Playbook ::

Redirect is part of Cisco IOS not Ansible.

Example
show ip bgp vpnv4 all | redirect flash0:/vpnv4.txt