On 07.03.2018 12:40, 'Daley Okuwa' via Ansible Project wrote:
Hi,

I have just done this manually on the switch and it worked

User Access Verification
Username: admin
Password:
POD2_C3560#copy running-config ftp:
Address or name of remote host []? 10.241.11.237
Destination filename [pod2_c3560-confg]?
Writing pod2_c3560-confg !!
8063 bytes copied in 1.108 secs (7277 bytes/sec)
POD2_C3560#

I think you forgot the exit at the end, so I included it.

  - name: run show command via Telnet using the expect module
    expect:
      command: telnet 10.101.250.12
      responses:
        Username: admin
        Password: xxxxx
        POD2_C3560#:
          - copy running-config ftp
          - exit
        Address or name of remote host \[\]\?: 10.241.11.237
        Destination filename \[.*\]\?: ''


The '' is the same as just pressing enter.
I have escaped []? with backslash since they are character with meaning in regex. Since the prompt POD2_C3560# comes up two times this is a list with the responses.



--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0acd2a8471c6fdc8bba9b7d66dd5aff6%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to