# Override Ansible Prompt Statement (used with pause module in playbook) during automation

**URL:** <https://forum.ansible.com/t/override-ansible-prompt-statement-used-with-pause-module-in-playbook-during-automation/37201>\
**Category:** Ansible Project\
**Created:** [October 11, 2022, 6:02am UTC](https://forum.ansible.com/t/override-ansible-prompt-statement-used-with-pause-module-in-playbook-during-automation/37201 "2022-10-11T06:02:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![neha0021997](https://avatars.discourse-cdn.com/v4/letter/n/34f0e0/32.png) [@neha0021997](https://forum.ansible.com/u/neha0021997)\
**Post date:** [October 11, 2022, 6:02am UTC](https://forum.ansible.com/t/override-ansible-prompt-statement-used-with-pause-module-in-playbook-during-automation/37201/1 "2022-10-11T06:02:51Z")

</div>

Hi Team,

I have written one playbook which is calling prompt statement (through pause module) and based on prompt response, it is calling the role. Please find the written playbook below:

**- hosts: primary-metal-console:primary-virtual-console**

**gather\_facts: yes**

**pre\_tasks:**

**- name: Verification Step before starting the playbook**

**pause:**

**prompt: “You are starting staging patching playbook on {{ansible\_hostname}} \n To Continue, please enter ‘YES’”**

**register: result**

**roles:**

**- role: patch\_stage**

**when: result.user\_input == “YES”**

Now, this is working properly while I ran the playbook through CMD. But We have automation (rundeck and soon to be a nightly jenkins patch build) that trigger patch playbooks. This change will break the ability of those playbooks to run. Since the default response is ‘NO’, any time this playbook is triggered in ‘non interactive mode’ it won’t do anything. I’m fine with the prompt being there, but there needs to be some way for automation to run the playbook. It could be some variable that can be specified to skip the check when playbook runs through automation.  
**Overall, is there any way to skip the prompt or that conditional check to call role, while playbook runs through automation?**

Thanks & Regards

Neha Singh

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [October 11, 2022, 8:02am UTC](https://forum.ansible.com/t/override-ansible-prompt-statement-used-with-pause-module-in-playbook-during-automation/37201/2 "2022-10-11T08:02:00Z")

</div>

you could supply (or use an existing) environment variable to signal  
that a CI is being used

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 11, 2022, 12:57pm UTC](https://forum.ansible.com/t/override-ansible-prompt-statement-used-with-pause-module-in-playbook-during-automation/37201/3 "2022-10-11T12:57:26Z")

</div>

if ansible detects it is running in batch (no tty) it will not prompt,  
so I would suggest setting defaults or allowing other methods of  
providing the value (extra vars?)

---

<div class="post-metadata">

**Author:** ![neha0021997](https://avatars.discourse-cdn.com/v4/letter/n/34f0e0/32.png) [@neha0021997](https://forum.ansible.com/u/neha0021997)\
**Post date:** [October 12, 2022, 3:55am UTC](https://forum.ansible.com/t/override-ansible-prompt-statement-used-with-pause-module-in-playbook-during-automation/37201/4 "2022-10-12T03:55:46Z")

</div>

Hi Guys,

Thank you for your suggestion. I need some clarification on the above given points.

Regarding using any environment variable from Command Line to check whether the playbook has been executing from there or through via automation (like rundeck or Jenkins), that’s what your are specifying from your point? Could you please let me know any specific env variable which I can used here. Because I have this restriction in code to use any existing var, don’t want to set up any new ones. That would be helpful if you could share your views.

I wanted to confirm, like setting extra vars in runback or Jenkins before running any playbook. Could you please explain the same in detail. Or other way of setting the var, please let me know.

**I just wanted to know any way to skip the prompt or that conditional check to call role, while my playbook runs through automation, any detail guidance from your side will be really helpful. I am looking forward to it.**

Thanks & Regards

Neha Singh
