# I have problems with de expect module

**URL:** <https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400>\
**Category:** Ansible Project\
**Created:** [October 1, 2019, 12:17pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400 "2019-10-01T12:17:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Esparza](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Javier\_Esparza](https://forum.ansible.com/u/Javier_Esparza)\
**Post date:** [October 1, 2019, 12:17pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/1 "2019-10-01T12:17:34Z")

</div>

Hello guys, i have a installation of a scanner, in this instalation y have to anser 4 questions, if i’m agree with the terms etc. i find the expect module but not a lot of information of it. here comes my code…

- name: installation scanner

expect:  
command: /tmp/uld/install-scanner.sh  
response:  
Questions:

- “Press Enter to continue or q and then Enter to quit.:” : “\n”
- “Do you agree ? [y/n]” : “y”
- “–More–” : “\r”
- “If you want to configure firewall automatically, enter y or just press Enter. To skip, enter n.” : “n”

but i get that:

![ErrorAnsible.PNG](https://us1.discourse-cdn.com/ansible/optimized/2X/c/c261b8e85275f61b9c652ed679f42ae383e009c9_2_320x13.png)

---

<div class="post-metadata">

**Author:** ![Soniya\_panwar](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@Soniya\_panwar](https://forum.ansible.com/u/Soniya_panwar)\
**Post date:** [October 3, 2019, 5:39am UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/2 "2019-10-03T05:39:34Z")

</div>

Hello Javier,

You are getting this error because you have used response instead of responses in expect module parameters.

Please use the below playbook:

- name: installation scanner  
expect:  
command: /tmp/uld/install-scanner.sh  
responses:  
Question:
- “Press Enter to continue or q and then Enter to quit.:” : “\n”
- “Do you agree ? [y/n]” : “y”
- “–More–” : “\r”
- “If you want to configure firewall automatically, enter y or just press Enter. To skip, enter n.” : “n”

Thanks  
Soniya

---

<div class="post-metadata">

**Author:** ![Javier\_Esparza](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Javier\_Esparza](https://forum.ansible.com/u/Javier_Esparza)\
**Post date:** [October 4, 2019, 3:24pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/3 "2019-10-04T15:24:51Z")

</div>

```auto
Thanks Soniya for answering, I did it, but I get errors, here they are, I don't know if the error is in the questions or in the answer, can u help me???

```

![ErrorAnsible.PNG](https://us1.discourse-cdn.com/ansible/optimized/2X/a/a63890bd655da93b80646705369bd9c29edf0f09_2_690x34.png)

---

<div class="post-metadata">

**Author:** ![Javier\_Esparza](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Javier\_Esparza](https://forum.ansible.com/u/Javier_Esparza)\
**Post date:** [October 7, 2019, 9:16pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/4 "2019-10-07T21:16:53Z")

</div>

Anyone can help me???

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 8, 2019, 3:52pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/5 "2019-10-08T15:52:36Z")

</div>

I already did by giving you a working task in your previous thread.

---

<div class="post-metadata">

**Author:** ![Javier\_Esparza](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Javier\_Esparza](https://forum.ansible.com/u/Javier_Esparza)\
**Post date:** [October 8, 2019, 4:36pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/6 "2019-10-08T16:36:08Z")

</div>

> Friend I tryed he code that you given to me but i got some errors

 ![Screenshot_20191008_133306.png](https://us1.discourse-cdn.com/ansible/original/2X/e/e12f9d9262f1e36ccd77444b3c2877b60821d614.png)

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 8, 2019, 7:48pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/7 "2019-10-08T19:48:54Z")

</div>

As requested before, can you please send TEXT only and no pictures.

Copy paste text.  
NO screen dumps.

Thx

> **(attachments)**
>
> ![Screenshot_20191008_133306.png](https://us1.discourse-cdn.com/ansible/original/2X/e/e12f9d9262f1e36ccd77444b3c2877b60821d614.png)

---

<div class="post-metadata">

**Author:** ![Javier\_Esparza](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Javier\_Esparza](https://forum.ansible.com/u/Javier_Esparza)\
**Post date:** [October 8, 2019, 9:13pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/8 "2019-10-08T21:13:36Z")

</div>

Here comes the error of my playbook…

---

<div class="post-metadata">

**Author:** ![P\_Varsha](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@P\_Varsha](https://forum.ansible.com/u/P_Varsha)\
**Post date:** [October 9, 2019, 5:17am UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/9 "2019-10-09T05:17:54Z")

</div>

once check your file name install-scanner.sh is correct?

---

<div class="post-metadata">

**Author:** ![Javier\_Esparza](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@Javier\_Esparza](https://forum.ansible.com/u/Javier_Esparza)\
**Post date:** [October 9, 2019, 12:12pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/10 "2019-10-09T12:12:08Z")

</div>

```auto
Yeah that's right. The problem I can read is that the installation does not go to the next question, It stays charging in the terms and conditions part.

```

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 10, 2019, 7:35pm UTC](https://forum.ansible.com/t/i-have-problems-with-de-expect-module/31400/11 "2019-10-10T19:35:59Z")

</div>

\<snip /\>

An output without the task/playbook is more and less useless.  
For more readability please set the stdout\_callback = debug in ansible.cfg or use this when you run ansible-playbook

&nbsp;&nbsp;&nbsp;ANSIBLE\_STDOUT\_CALLBACK=debug ansible-playbook playbook.yml
