why is this task hanging? (shell module)

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

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.

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