# Placement of vars\_promt

**URL:** <https://forum.ansible.com/t/placement-of-vars-promt/16161>\
**Category:** Ansible Project\
**Created:** [September 9, 2014, 5:25pm UTC](https://forum.ansible.com/t/placement-of-vars-promt/16161 "2014-09-09T17:25:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiglath](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@Tiglath](https://forum.ansible.com/u/Tiglath)\
**Post date:** [September 9, 2014, 5:25pm UTC](https://forum.ansible.com/t/placement-of-vars-promt/16161/1 "2014-09-09T17:25:31Z")

</div>

My test playbook for the flow I want is shown below:

I want some work done, then prompt the user, then more work, a pause, and the end.

The thing is that the prompt comes up even before gathering facts, not as suggested by its placement in the playbook.

Can the prompting be done between tasks?

Thanks

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 9, 2014, 7:17pm UTC](https://forum.ansible.com/t/placement-of-vars-promt/16161/2 "2014-09-09T19:17:23Z")

</div>

Ansible plays are hashes, they are a collection of attributes.

Tasks are an ordered list.

Thus including “vars\_prompt” ahead or behind “tasks” makes no difference.

vars\_prompt happens before the current play runs, every time.

You can solve this problem by stopping the current play, starting a new one with a vars\_prompt in it, and then continuing, since a playbook can contain multiple plays in a single file.

---

<div class="post-metadata">

**Author:** ![Tiglath](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@Tiglath](https://forum.ansible.com/u/Tiglath)\
**Post date:** [September 10, 2014, 4:57am UTC](https://forum.ansible.com/t/placement-of-vars-promt/16161/3 "2014-09-10T04:57:44Z")

</div>

Many thanks. I apologize but I am not proficient enough to know what you mean exactly.

Something like this?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 10, 2014, 12:30pm UTC](https://forum.ansible.com/t/placement-of-vars-promt/16161/4 "2014-09-10T12:30:40Z")

</div>

Basically.

You can consolidate and get the same effect:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 10, 2014, 12:33pm UTC](https://forum.ansible.com/t/placement-of-vars-promt/16161/5 "2014-09-10T12:33:45Z")

</div>

Hi Petros,

Seems you are asking a bit of a different question…

I don’t particularly like this suggested approach because it conflates two very different concepts - prompting with setting variables, in one line that is hard to read. Also, ansible only accepts _one_ value for each argument, so specifying prompt twice is weird, and specifying the name of the variable in the prompt string is very un-ansible-like as well.

Two, it sounds like what you really would want is a new action plugin called “prompt”, which I would be open to, which would look a lot like the source to pause.py

- prompt: var=“foo” message=“foo?”
- prompt: var=“spork” message=“Sporks are cool?”
- set\_fact: combined=“{{ foo }}-{{ spork }}”

---

<div class="post-metadata">

**Author:** ![Tiglath](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@Tiglath](https://forum.ansible.com/u/Tiglath)\
**Post date:** [September 10, 2014, 3:05pm UTC](https://forum.ansible.com/t/placement-of-vars-promt/16161/6 "2014-09-10T15:05:12Z")

</div>

> Hi Petros,

I’m Joseph, actually.

Gratitude for all your replies.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 10, 2014, 4:14pm UTC](https://forum.ansible.com/t/placement-of-vars-promt/16161/7 "2014-09-10T16:14:31Z")

</div>

You are welcome, though that particular reply about new set\_fact syntax was for Petros 🙂

The other was for you though 🙂
