On Friday, 17 November 2017 16.10.08 CET [email protected] wrote:
> Thank you Kai
>
> i write my code here just to explain what i'm doing:
>
>
> - name: Launch the CLI with new password
> expect:
> command: telnet 0 2200
> responses:
> login: "user"
> Password: "password"
> Press any key to continue\.: ""
> Enable Secure Backup mode.*: "n"
> Enable Common Criteria Compatibility mode.*: "n"
> idg#.*: "configure terminal"
> idg\(config\)#: "web-mgmt"
> idg\(config web-mgmt\)#: "admin-state enabled"
> idg\(config web-mgmt\)#: "local-address 127.0.0.1 9090"
> idg\(config web-mgmt\)#: "exit"
> idg\(config\)#: "write memory"
> idg#: "exit"
>
> The problem here are 2:
>
> 1) I don't know why but when the task arrives to* idg\(config web-mgmt\)#
> *using
> -vvv it is stuck and do not go on.
Very hard to say without the -vvv output.
I see you are using .*, with expect this does nothing.
The reason is that expect is non-greedy, the * means is 0 or more, and since
it's non-greedy that means no character at all.
> 2) As you can see there are responses repeated, and this means that ansible
> will take always the last occurance.
You can only have one question, but many answers, but the answers must be in a
list.
It will the use the fist item the fist time it sees the question and the second
one the next time is sees the same question.
responses:
login: "user"
Password: "password"
Press any key to continue\.: ""
Enable Secure Backup mode: "n"
Enable Common Criteria Compatibility mode: "n"
idg#:
- configure terminal
- exit
idg\(config\)#:
- web-mgmt
- write memory
idg\(config web-mgmt\)#:
- "admin-state enabled"
- "local-address 127.0.0.1 9090"
- "exit"
--
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/5612356.rZ2Um1fYUc%40x1.
For more options, visit https://groups.google.com/d/optout.