How to start a task that keeps running

ansible

Suppose I have a WildFly server that I remote install onto a machine with Ansible. Now I want Ansible to start it by running the standalone.sh script.

- name: start wildfly
      shell: "{{bin}}/standalone.sh -b 0.0.0.0 2>&1 >/dev/null "
      args:
        chdir: "/tmp/{{wildfly}}"

When I do that, the server gets started, but my Ansible playbook hangs.
When I add & at the end of the command line (which is why I use the shell task), the server starts and is immediately killed.
(Similar when I use command instead of shell.

I understand that the service task requires an entry in /etc/init.d or similar, so that is not really of help.

Best Answer

I understand that the service task requires an entry in /etc/init.d or similar, so that is not really of help.

Create one. An Upstart service can be as easy as a couple simple lines. Here's an example for Papertrail's remote_syslog.