# lookup inside default issue

**URL:** <https://forum.ansible.com/t/lookup-inside-default-issue/16176>\
**Category:** Ansible Project\
**Created:** [September 10, 2014, 10:13pm UTC](https://forum.ansible.com/t/lookup-inside-default-issue/16176 "2014-09-10T22:13:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergey\_Sudakovich](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Sergey\_Sudakovich](https://forum.ansible.com/u/Sergey_Sudakovich)\
**Post date:** [September 10, 2014, 10:13pm UTC](https://forum.ansible.com/t/lookup-inside-default-issue/16176/1 "2014-09-10T22:13:05Z")

</div>

Can not figure out what is going on here:

tasks:

- jenkins\_job: uri={{jenkins\_uri}}  
username={{jusername}}  
password={{jpassword}}  
name=“{{branch}}_{{item[0]}}_{{item[1].dut | regex\_replace(‘-\d+$’, ‘’) }}”  
config=“branch\_TEST\_TYPE\_platform.xml”  
args:  
config\_params:  
templates\_base\_dir: “{{templates\_base\_dir}}”  
repo: “{{repo}}”  
branch: “{{branch}}”  
test\_branch: “{{branch}}”  
test\_type: “{{item[0]}}”  
test\_dut: “{{item[1].dut}}”  
test\_build\_label: “{{ item[1].build\_label | default( lookup(‘hydra’, item[1].dut) ) }}”  
with\_nested:
- “{{phases}}”
- “{{duts}}”

The above code sets the value for ‘test\_build\_labe;’ to “”, but this code

vars:

- dut: abc-123-xyz
- hydra: “{{ test | default( lookup(‘hydra’, dut) ) }}”

tasks:

- debug: msg=“DUT {{dut}} has HYDRA {{hydra}}”

Works perfectly fine.

I am sure I missed a quote or something silly like that - does anybody have any experience with lookup inside a default and could spot a problem?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 11, 2014, 2:25pm UTC](https://forum.ansible.com/t/lookup-inside-default-issue/16176/2 "2014-09-11T14:25:17Z")

</div>

Hi,

This is a big ball of stuff and jenkins\_job isn’t a core module, can you summarize a little bit about what you find to be strange behavior?

I am having a hard time telling how the jenkins\_job module call is related to the things below or what ‘hydra’ does.

---

<div class="post-metadata">

**Author:** ![Sergey\_Sudakovich](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Sergey\_Sudakovich](https://forum.ansible.com/u/Sergey_Sudakovich)\
**Post date:** [September 16, 2014, 11:37pm UTC](https://forum.ansible.com/t/lookup-inside-default-issue/16176/3 "2014-09-16T23:37:47Z")

</div>

Sorry for confusing post - that was a problem on my end + updating to the latest version helped too.
