why is this task hanging? (shell module)

28 views
Skip to first unread message

Willard Dennis

unread,
Jul 5, 2015, 1:55:08 PM7/5/15
to ansible...@googlegroups.com
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

Brian Coca

unread,
Jul 5, 2015, 8:01:24 PM7/5/15
to ansible...@googlegroups.com
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.



--
Brian Coca

Willard Dennis

unread,
Jul 6, 2015, 11:12:00 PM7/6/15
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages