# why is this task hanging? (shell module)

**URL:** <https://forum.ansible.com/t/why-is-this-task-hanging-shell-module/18681>\
**Category:** Ansible Project\
**Created:** [July 5, 2015, 5:55pm UTC](https://forum.ansible.com/t/why-is-this-task-hanging-shell-module/18681 "2015-07-05T17:55:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will\_Dennis](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@Will\_Dennis](https://forum.ansible.com/u/Will_Dennis)\
**Post date:** [July 5, 2015, 5:55pm UTC](https://forum.ansible.com/t/why-is-this-task-hanging-shell-module/18681/1 "2015-07-05T17:55:08Z")

</div>

Hi all,

Wrote a task as follows:

- name: Bootstrap Consul servers  
shell: /usr/local/bin/consul agent -server -bootstrap-expect 3 -data-dir /tmp/consul -dc nyc3 -bind {{ ansible\_default\_ipv4.address }} \>\> {{ consul\_log\_file }} 2\>&1  
tags: bootconsulsvrs

When my playbook gets to this task, it hangs… (but it does successfully start the desired program…) How can I rewrote this so that the playbook continues?

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 6, 2015, 12:01am UTC](https://forum.ansible.com/t/why-is-this-task-hanging-shell-module/18681/2 "2015-07-06T00:01:17Z")

</div>

The reason it is 'hanging' is because you are not detaching from the  
console, this is not the recommended way of running services, I would  
use an init/rc script or upstart/systemd config. But if you MUST do it  
this way, try prepending nohup.

---

<div class="post-metadata">

**Author:** ![Will\_Dennis](https://avatars.discourse-cdn.com/v4/letter/w/919ad9/32.png) [@Will\_Dennis](https://forum.ansible.com/u/Will_Dennis)\
**Post date:** [July 7, 2015, 3:12am UTC](https://forum.ansible.com/t/why-is-this-task-hanging-shell-module/18681/3 "2015-07-07T03:12:00Z")

</div>

Thanks for the response, Brian. Just doing a quick-n-dirty testbed setup via Ansible involving Consul, so the ‘nohup’ tip will work for now.

- Will
