You’re better off using your OS daemon functionality like systemd or rc.d 
script and letting the os handle all of this rather than trying to reinvent all 
of that in Ansible. Then you can use a notify to the service module in a 
handler.

Dave

On Mon, 26 Aug 2019, at 15:53, Ravi Ranjan wrote:
> Hi Team ,
> 
> I am planning to do up gradation some app and for so we need to restart the 
> java application once my other app is upgraded and for so , i have written a 
> playbook.
> 
> can someone please help to write a play for starting the application . ( 
> Start command i have grep from "ps -ef | grep java | grep newrelic )
> 
> [root@chnr1-book4flights4extapi-1 ~]# ps -ef | grep java | grep newrelic
> lmny+ 8328 1 0 Jul09 ? 06:10:13 *java -server -Xms1g -Xmx3g -d64 
> -Dnewrelic.config.distributed_tracing.enabled=true 
> -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 
> -Dcom.sun.management.jmxremote.authenticate=false 
> -Dcom.sun.management.jmxremote.ssl=false -XX:+UseG1GC 
> -Dct.ctconfig.consul.server=http://consul-ctconfig.cltp.com:8500 
> -Dct.common.servertype=book4flights4extapi -Dapp.context.path=book 
> -Dspring.profiles.active=prod,book4flights4extapi 
> -javaagent:/opt/cal/newrelic/newrelic.jar -jar /opt/cal/latest.war *
> *
> *
> *Note** - *letter in bold letter is start command.
> _Command to start the application is_ :- *nohup* *java -server -Xms1g -Xmx3g 
> -d64 -Dnewrelic.config.distributed_tracing.enabled=true 
> -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9004 
> -Dcom.sun.management.jmxremote.authenticate=false 
> -Dcom.sun.management.jmxremote.ssl=false -XX:+UseG1GC 
> -Dct.ctconfig.consul.server=http://consul-ctconfig.cltp.com:8500 
> -Dct.common.servertype=book4flights4extapi -Dapp.context.path=book 
> -Dspring.profiles.active=prod,book4flights4extapi 
> -javaagent:/opt/cal/newrelic/newrelic.jar -jar /opt/cal/latest.war &*
> *
> *
> *Playbook:*
> *
> *
> *tasks:*
> * - name: Create a directory to take the backup of old new relic 
> configuration *
> * file:*
> * path: /opt/cal/newrelic/newrelic_old*
> * state: directory*
> * mode: '0755'*
> *
> *
> * - name: To take the backup of all the existing new configuration of 
> newrelic*
> * shell: "mv /opt/cal/newrelic/newrelic* /opt/cal/newrelic/newrelic_old/"*
> *
> *
> * - name: " To update the new relic version of jar "*
> * copy:*
> * src: /home/raviranjan/newrelic/{{ item }}*
> * dest: /opt/cal/newrelic/*
> * with_items:*
> * - newrelic.jar*
> * - newrelic.yml *
> * *
> * - name: To get the running process for newrelic*
> * shell: "ps -ef | grep java | grep newrelic | awk '{print $2}' | xargs kill 
> -9 " *
> * register: running_process*
> *
> *
> *
> *
> * - name: To start the application*
> * *
> * *
> *
> *
> any guidance would be much appreciated 
> *
> *
> *
> *
> *
> *
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/168e5fb5-1842-4075-ae40-982aa21a9df8%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/168e5fb5-1842-4075-ae40-982aa21a9df8%40googlegroups.com?utm_medium=email&utm_source=footer>.

—
 Dave Cottlehuber
 +43 67 67 22 44 78
 Managing Director
 Skunkwerks, GmbH
 http://skunkwerks.at/
 ATU70126204
 Firmenbuch 410811i

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d8792ffe-2ed0-4963-af86-10d24d343438%40www.fastmail.com.

Reply via email to