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. In the currently released version of this module, you should either define unique questions, or assume that the module will respond with the same answer to your single question. The pattern of ".*?:$" effectively matches anything. You should be more specific, or take a look at the updated module with the functionality added in https://github.com/ansible/ansible-modules-extras/pull/1522 On Tue, Feb 9, 2016 at 12:05 PM, CD Truong <[email protected]> wrote: > Hi, > > I ran into a problem with expect module 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 #The script will return 4 > response > responses: > '.*?:$': '12345' > '.*?:$': '12345' > '.*?:$': 'xena-warrior' > '.*?:$': '12345' > echo: yes > > All prompts have end of line ':' > > From the output I can see the response '12345' in the third prompt and not > 'xena-warrior'. > > Any help would greatly appreciated, > > David. > > -- > 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/f2d6c7d3-bff8-4191-8441-1d7dfb7b568a%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/f2d6c7d3-bff8-4191-8441-1d7dfb7b568a%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-PH6N8rWXinE9GCpNVK1WpEggKOmchaOC0tk-5TxABmw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
