All of your "questions" are the same.  Because you are defining a hash/dict
for responses, by providing the same key you are over writing the values.

If you need to respond multiple times to a question with different answers,
this is not currently possible with the released version of the expect
module but will be included in the next release.

On Friday, February 5, 2016, CD Truong <[email protected]> wrote:

> Hi,
>
> I ran across a problem with expect response the same value to all prompt.
>
> I have a task that execute a command and expecting four prompt the expect
> module response to the first prompt correctly but response to the 2nd & 3rd
> prompt with the same value from the 1st prompt.
>
>  - expect:
>     command: /path/to/the/script.sh
>     responses:
>      '.*?:$': '12345'
>      '.*?:$': '12345'
>      '.*?:$': 'xena-warrior'
>      '.*?:$': '12345'
>     echo: yes
>
> All prompts have end of line ':'
>
> From the output I can see the reponse '12345' in the third prompt and not
> 'xena-warrior'.
>
> Any help would greatly appreciated,
>
> David.
>
>
> On Friday, September 4, 2015 at 4:53:57 AM UTC-5, Edgars wrote:
>>
>> Hi
>>
>> I have this task:
>>
>>   tasks:
>>     - expect:
>>         command: /path/to/bash/script.sh
>>         responses:
>>           '#? ': '5'
>>           "[y/N]": 'y'
>>
>> expect module correctly responds to first prompt, but not to second. It
>> responds to second prompt with '5' when it should respond with 'y'.
>>
>> When I enable echo=yes, I see:
>>
>> ...
>> "#? 5"
>>
>> "[y/N]5"
>>
>> ...
>>
>> You can easily reproduce it with bash script and two echo/read
>>
>> Edgars
>>
> --
> 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]
> <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f8753982-6d44-4381-b0ca-dda5a0b9b2dc%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f8753982-6d44-4381-b0ca-dda5a0b9b2dc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v_3yyWqmz2pgUqxNxVNJ1CwPOJVk0r_A%2B4vnxrxHyShmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to