Hi,
I use ansible 2.0.0. and I want start a java web program which use spring boot and compile as a jar file, but it always don’t work.
I can execute “nohup java -jar xxx.jar &” on the target machine (the target machine is centos 7),but when I execute through ansible, it don’t work.
my playbook is
`
- hosts: testservers
remote_user: root
tasks: - name: start product
shell: chdir=/app nohup java -jar /app/product.jar &
`
I think all the method I can , for example, make a .sh file in the target machine, the sh file is
`
#!/bin/bash
java -jar /app/product.jar > /dev/null 2>&1
`
and I execute the sh file , it can start .
and the playbook is
`
shell: chdir=/app nohup ./startproduct.sh &
`
and I execute the playbook,
the product.jar can not be started yet.
and then I add it to service, the file is
`
#!/bin/bash