# Missing lines in \<var\>.stdout\_lines?

**URL:** <https://forum.ansible.com/t/missing-lines-in-var-stdout-lines/19524>\
**Category:** Ansible Project\
**Created:** [October 16, 2015, 1:51pm UTC](https://forum.ansible.com/t/missing-lines-in-var-stdout-lines/19524 "2015-10-16T13:51:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rob\_Wilkerson](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@Rob\_Wilkerson](https://forum.ansible.com/u/Rob_Wilkerson)\
**Post date:** [October 16, 2015, 1:51pm UTC](https://forum.ansible.com/t/missing-lines-in-var-stdout-lines/19524/1 "2015-10-16T13:51:11Z")

</div>

I have a task that installs nvm and node. When installing node (i.e. nvm install v0.12.2), Ansible seems to think the machine state has been changed, even if that version of Node is already installed. When run from the command line when the version is already there, I get this:

$ nvm install v0.12.2  
v0.12.2 is already installed.  
Now using node v0.12.2 (npm v2.7.4)

I added the following to the task:

register: node\_installed  
changed\_when: “‘is already installed’ is not in node\_installed.stdout”

It never picked up and continued to reflect a change, perhaps because there are multiple lines in the output. However, when I debug: node\_installed.stdout\_lines I still only get the second line.

What am I missing?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [October 16, 2015, 2:42pm UTC](https://forum.ansible.com/t/missing-lines-in-var-stdout-lines/19524/2 "2015-10-16T14:42:07Z")

</div>

It looks like you need to inspect `node_installed.stderr` instead of `stdout`. The string you are looking for seems to go there instead.

ok: [localhost] =\> {  
“changed”: false,  
“foo”: {  
“\_ansible\_no\_log”: false,  
“changed”: true,  
“cmd”: “. /Users/matt/.nvm/nvm.sh && nvm install v0.12.2”,  
“delta”: “0:00:04.243197”,  
“end”: “2015-10-16 09:41:08.582763”,  
“rc”: 0,  
“start”: “2015-10-16 09:41:04.339566”,  
“stderr”: “v0.12.2 is already installed.”,  
“stdout”: “Now using node v0.12.2 (npm v2.7.4)”,  
“stdout\_lines”: [  
“Now using node v0.12.2 (npm v2.7.4)”  
],  
“warnings”:   
}  
}

---

<div class="post-metadata">

**Author:** ![Rob\_Wilkerson](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@Rob\_Wilkerson](https://forum.ansible.com/u/Rob_Wilkerson)\
**Post date:** [October 16, 2015, 3:18pm UTC](https://forum.ansible.com/t/missing-lines-in-var-stdout-lines/19524/3 "2015-10-16T15:18:13Z")

</div>

Thanks, Matt. You beat me to it.

I didn’t expect that to generate an error, but after posting (unfortunately) I figured I should just inspect the whole variable and I found what you found. Punitive head slap for me.

I appreciate the assist.
