script execution is failed in ansible

56 views
Skip to first unread message

Makesh

unread,
Sep 25, 2018, 11:27:59 PM9/25/18
to Ansible Project
Hi Team,

Am automating my TIbco EMS restart service using Ansible. I have tried to execute the shell script from the server where ansible installed and also remote server but the service is not coming up also not getting any error, the same script execution was successful if run shell script in both Remote and Ansible server.  Please help.

My Play book.

---
- hosts: all
  remote_user: tibco

  tasks:
  - name: Start the EMS  services
    script:  TibemsStatus.sh {{emsserver}} {{actions}}
    register: startemsoutput
  - debug:
      var: startemsoutput.stdout_lines


My Shell script

case "$2" in
  start)
        if [ $PID ]; then
                echo "ems is already running for config file $conf_file. Check process id $PID";
        else
                echo "Starting tibems daemon for config file $conf_file."
#                cd $TIBEMS_ROOT && ./tibemsd64 -config $conf_file >  /dev/null 2>&1 &
                (/opt/tibco/ems/8.3/bin/tibemsd64 -config $conf_file > /dev/null 2>&1 &) && exit
                sleep 5
                PROCESS_PID;
                        if [ $PID ]; then
                        echo "Done. Started ./tibemsd64 -config $conf_file The process id is [ $PID ]"
                        else
                        echo "Could not start ./tibemsd64 on this box for config $conf_file"
                fi
        fi

Regards,
Makesh.

Kai Stian Olstad

unread,
Sep 28, 2018, 4:05:08 PM9/28/18
to ansible...@googlegroups.com
When the Ansible script task is finished all the child processes will be stopped.
To avoid that create proper init script to start and stop services.


--
Kai Stian Olstad


Abdulrazzaq shaik

unread,
Mar 17, 2021, 2:59:41 AM3/17/21
to Ansible Project
Hi Makesh,

Have to done the tibco installation and configuration with Ansible ?
Reply all
Reply to author
Forward
0 new messages