# Register variable not capturing

**URL:** <https://forum.ansible.com/t/register-variable-not-capturing/32442>\
**Category:** Ansible Project\
**Created:** [March 11, 2020, 10:09am UTC](https://forum.ansible.com/t/register-variable-not-capturing/32442 "2020-03-11T10:09:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sivaraman\_P](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sivaraman\_P](https://forum.ansible.com/u/Sivaraman_P)\
**Post date:** [March 11, 2020, 10:09am UTC](https://forum.ansible.com/t/register-variable-not-capturing/32442/1 "2020-03-11T10:09:22Z")

</div>

Hi I have the below playbook to stop and start the service using the script present in the the target machine,

tasks:  
&nbsp;&nbsp;- name : stop  
&nbsp;&nbsp;&nbsp;&nbsp;command: ./coconf.sh -stop &  
&nbsp;&nbsp;&nbsp;&nbsp;register: stop\_details

&nbsp;&nbsp;- debug: var=stop\_details

The actual output of stop details contains multiline as below

Using /opt/jre/1.6.0\_133/bin/java  
SLF4J: class path contain multiple SLF4J bindings.  
SLF4J: found binding in [jar:file]

like above 4 lines will be there.

But in my register variable I am able to get only the first line, which is

Using /opt/jre/1.6.0\_133/bin/java

Is there any way to capture the entire output in register variable??

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [March 11, 2020, 10:14am UTC](https://forum.ansible.com/t/register-variable-not-capturing/32442/2 "2020-03-11T10:14:44Z")

</div>

Why do you use & in your command? Doesn't make sense in this context.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Sivaraman\_P](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sivaraman\_P](https://forum.ansible.com/u/Sivaraman_P)\
**Post date:** [March 11, 2020, 10:20am UTC](https://forum.ansible.com/t/register-variable-not-capturing/32442/3 "2020-03-11T10:20:41Z")

</div>

& is present in the command to stop so I have used.. it is optional... and without & also I have used.. but still it is registering only the first line

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [March 11, 2020, 12:24pm UTC](https://forum.ansible.com/t/register-variable-not-capturing/32442/4 "2020-03-11T12:24:05Z")

</div>

It should be all there, so for example the following playbook:

---

<div class="post-metadata">

**Author:** ![Roberto\_Nozaki](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/roberto_nozaki/32/4596_2.png) [@Roberto\_Nozaki](https://forum.ansible.com/u/Roberto_Nozaki)\
**Post date:** [March 11, 2020, 4:56pm UTC](https://forum.ansible.com/t/register-variable-not-capturing/32442/5 "2020-03-11T16:56:38Z")

</div>

Are you sure that all lines are going to stdout (and not partially going to stderr)?
