# builtin.expect question

**URL:** <https://forum.ansible.com/t/builtin-expect-question/38254>\
**Category:** Ansible Project\
**Created:** [July 23, 2023, 2:03pm UTC](https://forum.ansible.com/t/builtin-expect-question/38254 "2023-07-23T14:03:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rodrigo\_Reis](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Rodrigo\_Reis](https://forum.ansible.com/u/Rodrigo_Reis)\
**Post date:** [July 23, 2023, 2:03pm UTC](https://forum.ansible.com/t/builtin-expect-question/38254/1 "2023-07-23T14:03:20Z")

</div>

Hello Everyone!

I trying to install ohmyzsh using ansible inside of a bigger yml file with a bunch of other sutff.  
in hte ansible.builtin.expect block the goal is to anwser one installation question but it waits for the timeou and display a huge error message.  
Basically sucessfully install ohmyzsh but not awnser the installation question.

What you guys think, I’m doing wrong or have a better way to do it?

- name: Check if Oh My Zsh is installed  
stat:  
path: /home/rreis/.oh-my-zsh  
register: ohmyzsh\_installed

- name: Install Oh My Zsh  
ansible.builtin.expect:  
command: sh /home/rreis/install.sh  
responses:  
‘Do you want to change your default shell to zsh? [Y/n]:’: “Y\n”  
timeout: 30  
when: ohmyzsh\_installed.stat.exists == false

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [July 24, 2023, 7:20pm UTC](https://forum.ansible.com/t/builtin-expect-question/38254/2 "2023-07-24T19:20:43Z")

</div>

Are you certain your install.sh script produces that literal string as the prompt?

‘Do you want to change your default shell to zsh? [Y/n]:’: “Y\n”

You can use a regex in the key side of the dictionary.

‘._change your default shell to zsh._’: “Y\n”

Maybe your string isn’t matching so it times out?

Walter

---

<div class="post-metadata">

**Author:** ![Will\_McDonald](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@Will\_McDonald](https://forum.ansible.com/u/Will_McDonald)\
**Post date:** [July 24, 2023, 7:26pm UTC](https://forum.ansible.com/t/builtin-expect-question/38254/3 "2023-07-24T19:26:08Z")

</div>

If you’re just trying to find a way to ALWAYS say “yes, install” then looking at [https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh#L37C31-L37C31](https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh#L37C31-L37C31) you could just pass in --unattended?

---

<div class="post-metadata">

**Author:** ![Rodrigo\_Reis](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Rodrigo\_Reis](https://forum.ansible.com/u/Rodrigo_Reis)\
**Post date:** [July 30, 2023, 4:18pm UTC](https://forum.ansible.com/t/builtin-expect-question/38254/4 "2023-07-30T16:18:38Z")

</div>

guys!  
Thank you for you response, unfortunettly change the respose not work but with --unnatend option I just ran "chsh -s $(which zsh)"after and voilá it is done!

Thank you very much for the support!

---

<div class="post-metadata">

**Author:** ![Rodrigo\_Reis](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Rodrigo\_Reis](https://forum.ansible.com/u/Rodrigo_Reis)\
**Post date:** [July 30, 2023, 6:55pm UTC](https://forum.ansible.com/t/builtin-expect-question/38254/5 "2023-07-30T18:55:45Z")

</div>

Hi Guys!  
Thank you for the responses  
I Just used unnatend option and at the end have this **chsh -s $(which zsh)** to set the zsh as default shell. works like charm!

I need to RTFM more… thank’s all!
