Run Script and display its output on the remote node

169 views
Skip to first unread message

Imran Khan

unread,
Sep 4, 2014, 4:01:00 AM9/4/14
to ansible...@googlegroups.com
Like the subject explains. I want to run an un-ending script and want to see the output on the remote node only. Is that possible ?

Imran Khan

unread,
Sep 4, 2014, 6:38:28 AM9/4/14
to ansible...@googlegroups.com

Maybe sth like:
    shell: screen -d -m bash /home/dell/tester_server_2/runserver.sh
    
But this is not doing the trick 

Michael DeHaan

unread,
Sep 4, 2014, 9:25:18 PM9/4/14
to ansible...@googlegroups.com
See here for some info about running "fire and forget" non-blocking tasks.


You may also be instead interested in 


Depending on how I interpret the question about "not seeing local output", one or both may be appropriate.




--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1ce6131a-3783-48b7-9d3a-ae837edc1ca5%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Imran Khan

unread,
Sep 5, 2014, 12:50:45 AM9/5/14
to ansible...@googlegroups.com
---
- hosts: server
  gather_facts: False

  tasks:
  - name: Run runserver.sh and save the output of script
    shell: screen -dRR bash /home/dell/tester_server_2/runserver.sh
    async: 99999999999
    poll: 0
I have already incorporated sth like that in my playbook. Now what I need is that if any of the remote nodes have been accessed by using Puttty or OpenStack Dashboard, they should display the output of the script on that individual screen. For instance, if the script I am executing contains echo "hello from ansible control node" and then goes to sleep for some time. The output on the individual user (all the nodes) should be hello form ansible control node . Each remote node should display this message on their respective screen, so that it is readable to any user that is currently sshed into the VM.

Philippe Eveque

unread,
Sep 5, 2014, 8:17:01 AM9/5/14
to ansible...@googlegroups.com
You mean acting as a remote wall(1) ?

maybe then just pipe the output to wall(1)


Phil



Imran Khan

unread,
Sep 5, 2014, 8:45:46 AM9/5/14
to ansible...@googlegroups.com
I am sorry but I am not familiar with that. Do you have a solution to this problem. Any relevant documentation?

Michael DeHaan

unread,
Sep 5, 2014, 3:15:02 PM9/5/14
to ansible...@googlegroups.com
", it should execute a script on all the targeted hosts and anybody who has sshed into that node should be able to see that script being run on their respective screen (for example if a script contains  echo "hello from ansible control node")"

AFAIK, such things do not exist.

You could definitely run something like "wall" to broadcast messages, start things in screen sessions, and so on, but this seems a bit weird for a standard automation use case to me.

Maybe I'm not following.




Reply all
Reply to author
Forward
0 new messages