# Possibility to see stdout of a shell command?

**URL:** <https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471>\
**Category:** Ansible Project\
**Created:** [April 30, 2012, 5:29pm UTC](https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471 "2012-04-30T17:29:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@Frank](https://forum.ansible.com/u/Frank)\
**Post date:** [April 30, 2012, 5:29pm UTC](https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471/1 "2012-04-30T17:29:32Z")

</div>

Hi,

is there a possibility to see stadout in addition to stderr of a shell  
command executed as part of a playbook?

Frank

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [April 30, 2012, 6:11pm UTC](https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471/2 "2012-04-30T18:11:08Z")

</div>

No, because of the pty usage involved in sudo ops, it is not included unless a module returns it in the JSON.

---

<div class="post-metadata">

**Author:** ![Frank](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@Frank](https://forum.ansible.com/u/Frank)\
**Post date:** [April 30, 2012, 6:24pm UTC](https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471/3 "2012-04-30T18:24:46Z")

</div>

Hi,

is it planed to have stdout for shell command for future release?

Frank

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [April 30, 2012, 6:41pm UTC](https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471/4 "2012-04-30T18:41:47Z")

</div>

Actually, shell commands already return this. They return stderr too, in the JSON.

I thought you were asking a general module question when a module leaks some stderr to actual stderr, versus capturing it and returning it a data structure.

They obviously do share all that from /usr/bin/ansible.

I do not plan to include those for playbooks as they are generally intended for idempotent config management. They do let you know more information when a failure occurs but keep  
quiet on success.

---

<div class="post-metadata">

**Author:** ![Frank](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@Frank](https://forum.ansible.com/u/Frank)\
**Post date:** [May 1, 2012, 5:34pm UTC](https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471/5 "2012-05-01T17:34:20Z")

</div>

It would be very, very useful, especially during development of a new  
play(book), to have an ansible-playbook command line option to enable  
printing out stdout results of shell command, because many commands  
print relevant information to stdout.

Frank

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 1, 2012, 5:51pm UTC](https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471/6 "2012-05-01T17:51:47Z")

</div>

> It would be very, very useful, especially during development of a new  
> play(book), to have an ansible-playbook command line option to enable  
> printing out stdout results of shell command, because many commands  
> print relevant information to stdout.

I suppose if -D was overloaded to show this it would be reasonable.

At that point, it probably should show the results of all commands though, and gets slightly overwhelming, but it’s better than having more flags and complexity.

---

<div class="post-metadata">

**Author:** ![Frank](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@Frank](https://forum.ansible.com/u/Frank)\
**Post date:** [May 1, 2012, 6:04pm UTC](https://forum.ansible.com/t/possibility-to-see-stdout-of-a-shell-command/11471/7 "2012-05-01T18:04:23Z")

</div>

That sound good - I can test as soon as this feature gets available.  
Just give me a hint ...

Frank
