# combining register: with with\_items: fails

**URL:** <https://forum.ansible.com/t/combining-register-with-with-items-fails/12631>\
**Category:** Ansible Project\
**Created:** [April 5, 2013, 12:06pm UTC](https://forum.ansible.com/t/combining-register-with-with-items-fails/12631 "2013-04-05T12:06:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [April 5, 2013, 12:06pm UTC](https://forum.ansible.com/t/combining-register-with-with-items-fails/12631/1 "2013-04-05T12:06:41Z")

</div>

Hi List,

I’m trying this (Simplified version):

**- name: Oracle | Figure out the paths that exist here**  
**action: shell ls /opt/oracle/product/**  
**register: oracle\_versions**

**- name: Oracle | Now find the specific admin paths**  
**action: shell find /opt/oracle/product/${item} -type d -name admin | grep -i network**  
**with\_items:**  
**- ${oracle\_versions.stdout\_lines}**  
**register: oracle\_admin\_path**

But this fails, it does not set the ${oracle\_admin\_path.stdout\_lines} to the value’s you’d expect from the example.  
Leaving out the “with\_items” from the example does work however. Like so:

**- name: Oracle | Now find the specific admin paths**  
**action: shell find /opt/oracle/product/${item} -type d -name admin | grep -i network**  
**register: oracle\_admin\_path**

Not exactly what I want so I’m asking wether this is correct behaviour and that I just don’t understand?

Thanks,  
Mark

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [April 5, 2013, 12:12pm UTC](https://forum.ansible.com/t/combining-register-with-with-items-fails/12631/2 "2013-04-05T12:12:24Z")

</div>

with\_items when used with register will store the result in an array, it doesn’t fail at all.

check what the value of the thing you registered by using the debug module and running in “-v” mode, and you should see what you get.

---

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [April 5, 2013, 12:17pm UTC](https://forum.ansible.com/t/combining-register-with-with-items-fails/12631/3 "2013-04-05T12:17:05Z")

</div>

Wrong choice of words. sorry. I did mention that I probably did not understand 😉

---

<div class="post-metadata">

**Author:** ![Mark\_Maas](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@Mark\_Maas](https://forum.ansible.com/u/Mark_Maas)\
**Post date:** [April 5, 2013, 12:28pm UTC](https://forum.ansible.com/t/combining-register-with-with-items-fails/12631/4 "2013-04-05T12:28:43Z")

</div>

Do you mean like this?

**- name: Oracle | Ophalen welke versie’s van Oracle er zijn**  
**action: shell ls /opt/oracle/product/**  
**register: oracle\_versions**

**- name: Oracle | Admin pad uitvogelen**  
**action: shell find /opt/oracle/product/ -type d -name admin | grep -i network**  
**with\_items:**  
**- ${oracle\_versions.stdout\_lines}**  
**register: oracle\_admin\_path**

**- name: Oracle | DEBUG!!!**

**action: debug msg=${oracle\_admin\_path} fail=yes**

Because that just gives me:

**TASK: [Oracle | DEBUG!!!] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\***  
 **ESTABLISH CONNECTION FOR USER: mmaas on PORT 22 TO taixkitty**  
**failed: [taixkitty] =\> {“failed”: true, “item”: “”}**  
**msg: {msg:**

**FATAL: all hosts have already failed – aborting**

Thanks,  
Mark

---

<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 5, 2013, 12:56pm UTC](https://forum.ansible.com/t/combining-register-with-with-items-fails/12631/5 "2013-04-05T12:56:58Z")

</div>

looks like you have some spaces in your shell command and it just didn’t work.

The FAIL is of course because you asked it to fail 🙂

I would consider writing an “oracle\_facts” module instead.
