Below is my playbook to backup info from router and save it to a file. But when i open the TXT file in ansible controller, backup info is very difficult to read. Please look at the screenshot in below link: https://drive.google.com/file/d/1QfDUG8j6NKTRhB78RYOSGZrNLRP8TW54/view?usp=sharing
Iam running ansible network automation device in GNS3. Is it because iam opening this file in ansible/linux device that the data is so dis-organized? If i were to open this TXT file in windows PC, will the data be in a readable format or should i change my script to make data more readable?
name: show version and other user level commands
hosts: R1
gather_facts: false
connection: local
tasks:
name: run multiple commands on remote nodes
ios_command:
commands:
register: print_output
name: save output to a file copy: content="{{ print_output.stdout_lines }}" dest="./output/{{ inventory_hostname }}.txt"
copy: content="{{ print_output.stdout | replace('\\n', '\n') }}" dest="./output/router1.txt"
Thanks for trying to help me.