backing up a cisco device using telnet

excellent…I was going to suggest checking it with YAML Lint! You addressed the proper YAML syntax for hosts (the dash) and the local_action line works for me in many playbooks but Kia Stian Oldsad is right that spacing is critical. If you want to attach your playbook I’d be happy to take a look at it.

it is me again
I just amended my YAML scripts still having errors I have use lint to check the spacing and indenting and it looks fine

My code

maybe you can try ntc-ansible. https://github.com/networktocode/ntc-ansible

Hi,

I would like to thank for telnet playbook that you provided. I am able to run show inventory command but for show run command, I am running with term len 0 and it does not store any output from show run.

cat vic-7yar-es-06-18.txt
terminal length 0

below is my playbook-

  • name: show version
    hosts: vic-7yar-es-06-18
    gather_facts: false
    connection: local
    tasks:
  • name: telnet sw
    telnet:
    user:
    password:
    login_prompt: "Username: "
    prompts:
  • ‘[>|#]’
    ios_command:
  • terminal length 0
  • show version

register: output

  • debug: var=output

  • local_action: copy content=“{{ output.output[0] }}” dest=“device_backups/{{ inventory_hostname }}.txt”