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