I am practising writing ansible playbook using Network automation docker container in GNS3. After running below playbook, only the output of first command is saved (show version) and i don’t see the 2nd command’s output in file. This happens for any command i run.
Am i doing something wrong or should i export the .txt file to a windows PC to view the complete output?
(formatting below is not in proper order while pasting here but playbook has the correct format)
Yes, removing [0] worked!!
I am learning ansible using a udemy tutorial and i am practising sample playbook in tutorial in GNS3. I am not sure why it worked for the author to save output of multiple commands with [0] present. It’s a 3 yr old course, probably something changed in ansible recently.
name: SAVE BACKUP TO A FILE NAMED WITH DEVICE HOSTNAME
copy: content=“{{ print_backup.stdout | join (‘\n’) }}" dest=”./iosupgrade/{{ inventory_hostname }}.txt"