# Run Script and display its output on the remote node

**URL:** <https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112>\
**Category:** Ansible Project\
**Created:** [September 4, 2014, 8:01am UTC](https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112 "2014-09-04T08:01:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Imran\_Khan1](https://avatars.discourse-cdn.com/v4/letter/i/a4c791/32.png) [@Imran\_Khan1](https://forum.ansible.com/u/Imran_Khan1)\
**Post date:** [September 4, 2014, 8:01am UTC](https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112/1 "2014-09-04T08:01:00Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Imran\_Khan1](https://avatars.discourse-cdn.com/v4/letter/i/a4c791/32.png) [@Imran\_Khan1](https://forum.ansible.com/u/Imran_Khan1)\
**Post date:** [September 4, 2014, 10:38am UTC](https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112/2 "2014-09-04T10:38:28Z")

</div>

> Maybe sth like:  
> shell: screen -d -m bash /home/dell/tester\_server\_2/runserver.sh

But this is not doing the trick

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 5, 2014, 1:25am UTC](https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112/3 "2014-09-05T01:25:14Z")

</div>

See here for some info about running “fire and forget” non-blocking tasks.

[http://docs.ansible.com/playbooks\_async.html](http://docs.ansible.com/playbooks_async.html)

You may also be instead interested in

[http://docs.ansible.com/faq.html#how-do-i-keep-secret-data-in-my-playbook](http://docs.ansible.com/faq.html#how-do-i-keep-secret-data-in-my-playbook)

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

---

<div class="post-metadata">

**Author:** ![Imran\_Khan1](https://avatars.discourse-cdn.com/v4/letter/i/a4c791/32.png) [@Imran\_Khan1](https://forum.ansible.com/u/Imran_Khan1)\
**Post date:** [September 5, 2014, 4:50am UTC](https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112/4 "2014-09-05T04:50:45Z")

</div>

```auto
---

```

```auto
- 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.

---

<div class="post-metadata">

**Author:** ![PhilEv](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@PhilEv](https://forum.ansible.com/u/PhilEv)\
**Post date:** [September 5, 2014, 12:16pm UTC](https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112/5 "2014-09-05T12:16:55Z")

</div>

You mean acting as a remote wall(1) ?

maybe then just pipe the output to wall(1)

Phil

---

<div class="post-metadata">

**Author:** ![Imran\_Khan1](https://avatars.discourse-cdn.com/v4/letter/i/a4c791/32.png) [@Imran\_Khan1](https://forum.ansible.com/u/Imran_Khan1)\
**Post date:** [September 5, 2014, 12:45pm UTC](https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112/6 "2014-09-05T12:45:46Z")

</div>

I am sorry but I am not familiar with that. Do you have a solution to this problem. Any relevant documentation?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 5, 2014, 7:14pm UTC](https://forum.ansible.com/t/run-script-and-display-its-output-on-the-remote-node/16112/7 "2014-09-05T19:14:58Z")

</div>

“, 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.
