# Beginner Question - debug msg

**URL:** <https://forum.ansible.com/t/beginner-question-debug-msg/25707>\
**Category:** Ansible Project\
**Created:** [October 9, 2017, 7:33pm UTC](https://forum.ansible.com/t/beginner-question-debug-msg/25707 "2017-10-09T19:33:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sardesco](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sardesco](https://forum.ansible.com/u/Sardesco)\
**Post date:** [October 9, 2017, 7:33pm UTC](https://forum.ansible.com/t/beginner-question-debug-msg/25707/1 "2017-10-09T19:33:55Z")

</div>

Hi, i am an absolute beginner in ansible.

I try to output a greped text via debug and msg

THIS WORKS

**- name: Check the Application version**  
**command: /usr/bin/myscrpit.sh APPLICATIONNAME status | grep Version**  
**register: version**

The result is: SCM Version 6.2

THIS doesn’t work

**- name: show the greped Version**  
**debug: msg: " {{ version} "**

But i received an error.

is the syntax wrong?

i tried : debug: msg: " {{ version.stdout } "

best regards  
Alex

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 9, 2017, 7:38pm UTC](https://forum.ansible.com/t/beginner-question-debug-msg/25707/2 "2017-10-09T19:38:53Z")

</div>

debug: msg: " {{ version}} " \<= its {{ and }} not a single ending }

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 9, 2017, 7:48pm UTC](https://forum.ansible.com/t/beginner-question-debug-msg/25707/3 "2017-10-09T19:48:44Z")

</div>

You also have a error in the syntax, you need to those between one of these

YAML syntax:

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [October 9, 2017, 8:03pm UTC](https://forum.ansible.com/t/beginner-question-debug-msg/25707/4 "2017-10-09T20:03:21Z")

</div>

Hi,

also (unrelated to the other answers and your question), you want to  
use the shell module ([https://docs.ansible.com/ansible/latest/shell\_module.html](https://docs.ansible.com/ansible/latest/shell_module.html))  
instead of the command module  
([https://docs.ansible.com/ansible/latest/command\_module.html](https://docs.ansible.com/ansible/latest/command_module.html)) so the  
piping to grep actually works.

Quoting from the documentation of the command module:

&nbsp;&nbsp;&nbsp;"The given command will be executed on all selected nodes. It  
&nbsp;&nbsp;&nbsp;&nbsp;will not be processed through the shell, so variables like  
&nbsp;&nbsp;&nbsp;&nbsp;$HOME and operations like "\<", "\>", "|", ";" and "&" will not  
&nbsp;&nbsp;&nbsp;&nbsp;work (use the shell module if you need these features)."

> \*- name: Check the Application version\*  
> \* command: /usr/bin/myscrpit.sh APPLICATIONNAME status | grep  
> Version\*  
> \* register: version\*

Cheers,  
Felix

---

<div class="post-metadata">

**Author:** ![Sardesco](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sardesco](https://forum.ansible.com/u/Sardesco)\
**Post date:** [October 10, 2017, 8:04am UTC](https://forum.ansible.com/t/beginner-question-debug-msg/25707/5 "2017-10-10T08:04:50Z")

</div>

WOW. Thanks a lot for the great support.
