# Ansible Expect Prompt set to a variable in Host not working

**URL:** <https://forum.ansible.com/t/ansible-expect-prompt-set-to-a-variable-in-host-not-working/37406>\
**Category:** Ansible Project\
**Created:** [December 1, 2022, 9:15am UTC](https://forum.ansible.com/t/ansible-expect-prompt-set-to-a-variable-in-host-not-working/37406 "2022-12-01T09:15:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phillip\_Wu](https://avatars.discourse-cdn.com/v4/letter/p/f4b2a3/32.png) [@Phillip\_Wu](https://forum.ansible.com/u/Phillip_Wu)\
**Post date:** [December 1, 2022, 9:15am UTC](https://forum.ansible.com/t/ansible-expect-prompt-set-to-a-variable-in-host-not-working/37406/1 "2022-12-01T09:15:15Z")

</div>

Hi,  
I’m trying to set Ansible Expect prompt to a variable in host file.

However this does not work.

You can see that Ansible is not sending a response to the prompt.  
The prompt is defined as the contents of a variable declared in host file.

Can someone see what is wrong?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 1, 2022, 2:36pm UTC](https://forum.ansible.com/t/ansible-expect-prompt-set-to-a-variable-in-host-not-working/37406/2 "2022-12-01T14:36:32Z")

</div>

Generally speaking, you cannot set keys anywhere in ansible to a template, this is simply just not allowed.

As such, there really isn’t a mechanism for doing this. Keys must be hardcoded.

---

<div class="post-metadata">

**Author:** ![Phillip\_Wu](https://avatars.discourse-cdn.com/v4/letter/p/f4b2a3/32.png) [@Phillip\_Wu](https://forum.ansible.com/u/Phillip_Wu)\
**Post date:** [December 2, 2022, 2:01am UTC](https://forum.ansible.com/t/ansible-expect-prompt-set-to-a-variable-in-host-not-working/37406/3 "2022-12-02T02:01:31Z")

</div>

Thanks

That’s a pity.

The prompt is different on each host that I’ll be adding (later)
