I used the "async" and "poll" options to work around this.  So my trouble 
task now looks like:

- name: start eum
    shell: bin/eum.sh start
    args:
      chdir: /opt/AppDynamics/EUEM/eum-processor/
    async: 30
    poll: 10



If I register the output as a variable and print it, it still only displays 
the "EUM Processor started..." line, but the EUM process is actually, as 
opposed to previously where it would not be fully started before the play 
ended.


Hope this helps someone else out!



On Tuesday, March 13, 2018 at 8:10:49 AM UTC-4, Patrick Hunt wrote:
>
> I have a play that is fairly simple, to start AppDynamics.  I am able to 
> start/stop each part as needed, except a portion called EUM (End User 
> Monitoring).
>
> My test play looks like:
>
> ---
> - hosts: collector
>   become: true
>   become_method: su
>   become_user: root
>
>
>   tasks:
>
>
>   - name: stop eum
>     shell: bin/eum.sh stop
>     args:
>       chdir: /opt/AppDynamics/EUEM/eum-processor/
>
>
>   - name: wait 2 minutes
>     wait_for:
>       timeout: 120
>     delegate_to: localhost
>
>
>   - name: start eum
>     shell: bin/eum.sh start
>     args:
>       chdir: /opt/AppDynamics/EUEM/eum-processor/
> ...
>
>
> The problem is with the "start eum" task.  The output from running the 
> playbook is:
>
> PLAYBOOK: restart_eum.yml 
> *************************************************************************************************************************************************************************
> 1 plays in restart_eum.yml
>
>
> PLAY [collector] 
> **********************************************************************************************************************************************************************************
>
>
> TASK [Gathering Facts] 
> ****************************************************************************************************************************************************************************
> ok: [eum-server]
> META: ran handlers
>
>
> TASK [stop eum] 
> ***********************************************************************************************************************************************************************************
> task path: /home/phunt/ansible/test/playbooks/restart_eum.yml:9
> changed: [eum-server] => {"changed": true, "cmd": "bin/eum.sh stop", 
> "delta": "0:00:01.047571", "end": "2018-03-13 07:52:38.369432", "rc": 0, 
> "start": "2018-03-13 07:52:37.321861", "stderr": "", "stderr_lines": [], 
> "stdout": "EUM Processor stopped.", "stdout_lines": ["EUM Processor 
> stopped."]}
>
>
> TASK [wait 2 minutes] 
> *****************************************************************************************************************************************************************************
> task path: /home/phunt/ansible/test/playbooks/restart_eum.yml:14
> ok: [eum-server -> localhost] => {"changed": false, "elapsed": 120, "path"
> : null, "port": null, "search_regex": null, "state": "started"}
>
>
> TASK [start eum] 
> **********************************************************************************************************************************************************************************
> task path: /home/phunt/ansible/test/playbooks/restart_eum.yml:19
> changed: [eum-server] => {"changed": true, "cmd": "bin/eum.sh start", 
> "delta": "0:00:01.031939", "end": "2018-03-13 07:54:42.994837", "rc": 0, 
> "start": "2018-03-13 07:54:41.962898", "stderr": "", "stderr_lines": [], 
> "stdout": "EUM Processor started (PID=23232).", "stdout_lines": ["EUM 
> Processor started (PID=23232)."]}
> META: ran handlers
> META: ran handlers
>
>
> PLAY RECAP 
> ****************************************************************************************************************************************************************************************
> eum-server              : ok=4    changed=2    unreachable=0    failed=0
>
>
>
> This indicates that the EUM processor has started, however, when I log 
> into the server EUM is not running.
>
> When entering the commands in manually to start eum there is an additional 
> line of output that is present 3-5 seconds after the "EUM Processor 
> started..." bit.  The output from manual run is:
>
>
>
> [root@collector eum-processor]# bin/eum.sh start
> Using EUM_HOME:   /opt/AppDynamics/EUEM/eum-processor
> Using EUM_PID:    pid.txt
> EUM Processor started (PID=23595).
> [root@collector eum-processor]# INFO  [2018-03-13 12:02:05,136] 
> org.eclipse.jetty.util.log: Logging initialized @2571ms
>
>
> Is there a way for me to wait for that INFO line before marking the task 
> as completed?
>
>
> Thank you, 
> Patrick
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/33216f6b-0dba-41be-ba73-b23f96070f49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to