You likely need to quote your answer, a bare `yes` in YAML is treated as a boolean, so you will need to quote it like: "yes"
On Thu, Sep 29, 2016 at 8:25 AM, Vikas Kumar <[email protected]> wrote: > Thanks Kai, > > I did tried that earlier but encountered below error > > An exception occurred during task execution. The full traceback is: > Traceback (most recent call last): > File "/var/folders/qw/5nbqbmj97hsfz3z5lkwqk9lr0000gn > /T/ansible_eLtUlG/ansible_module_expect.py", line 230, in <module> > main() > File "/var/folders/qw/5nbqbmj97hsfz3z5lkwqk9lr0000gn > /T/ansible_eLtUlG/ansible_module_expect.py", line 149, in main > response = u'%s\n' % value.rstrip('\n').decode() > AttributeError: 'bool' object has no attribute 'rstrip' > > fatal: [localhost]: FAILED! => {"changed": false, "failed": true, > "invocation": {"module_name": "expect"}, "module_stderr": "Traceback (most > recent call last):\n File \"/var/folders/qw/ > 5nbqbmj97hsfz3z5lkwqk9lr0000gn/T/ansible_eLtUlG/ansible_module_expect.py\", > line 230, in <module>\n main()\n File \"/var/folders/qw/ > 5nbqbmj97hsfz3z5lkwqk9lr0000gn/T/ansible_eLtUlG/ansible_module_expect.py\", > line 149, in main\n response = u'%s\\n' % > value.rstrip('\\n').decode()\nAttributeError: > 'bool' object has no attribute 'rstrip'\n", "module_stdout": "", "msg": > "MODULE FAILURE", "parsed": false} > > - Vikas > > On Thursday, 29 September 2016 23:12:46 UTC+10, Kai Stian Olstad wrote: >> >> On 29.09.2016 15:03, Vikas Kumar wrote: >> > Hello Everyone, >> > >> > How can I use Ansible expect module to say yes for this prompt. >> > >> > Are you sure you want to continue (yes/no)? >> > >> > I tried to use this in vain. I think Ansible does not like characters >> > like >> > these - *( , / , ) , ?* >> >> Ansible and expect like them. But responses in expect is regexp and (, ) >> and ? and many more is special character, >> for a full list see https://docs.python.org/2/library/re.html >> >> > >> > - expect: >> > command: /my/command >> > responses: >> > Are you sure you want to continue (yes/no)?: yes >> > >> >> The special characters need to be escaped since you mean them literally. >> Try this >> Are you sure you want to continue \(yes/no\)\?: yes >> >> -- >> 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/4a3128c3-873d-4b7f-8bb1-378e8d255dba%40googlegroups. > com > <https://groups.google.com/d/msgid/ansible-project/4a3128c3-873d-4b7f-8bb1-378e8d255dba%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-x98YXSAW8V4dZdZTzGCqwq_85qr2Bn4sP8ebF8CURSA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
