0

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.

  • You can try with nohup ....your_command... & – Dusan Bajic Oct 12 '15 at 20:31
  • 2
    Why aren't you making a service? – Michael Hampton Oct 12 '15 at 20:57
  • That would require modifying /etc/init.d which is not really desirable at the moment. But perhaps that is the only way. – Heiko Rupp Oct 13 '15 at 6:14
  • 2
    Unless you absolutely have to, don't reinvent the wheel, quickly googling showed me at least 2 roles that handle install and config of wildfly server, including setting up a service. If it suits your needs, use those existing roles. – Mxx Oct 13 '15 at 9:01
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.