##### SUMMARY
Hello everyone,

I try to browse a list with the function  _lookup_, but ansible don't find 
my list.
When I don't use _lookup_, this is working fine.


##### COMPONENT NAME
<!--- Write the short name of the module, plugin, task or feature below, 
use your best guess if unsure -->

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible --version
ansible 2.7.7
```
I tried with ansible 2.6 and 2.4 too

##### OS / ENVIRONMENT
macOS Mojave 10.14.3


##### STEPS TO REPRODUCE
<!--- Describe exactly how to reproduce the problem, using a minimal 
test-case -->

<!--- Paste example playbooks or commands between quotes below -->
```yaml
ansible-playbook playbook.yml -i inventories/pfu-secrets -e 
secret_name=nginx
```
```yaml
all.yml

nginx:
  - name: nginx_url
     dev: value_dev_url

  - name: nginx_conf
     dev: value_dev_conf
```
```yaml
playbook.yml

  - debug:
      msg: "{{ item.dev }}"
    loop: "{{ lookup('vars', secret_name) }}"

  - set_fact:
      test: "item.dev"

  - debug:
      msg: "{{ vars[ test ] }} "
    loop: "{{ lookup('vars', secret_name) }}"
```
##### EXPECTED RESULTS

```paste below
TASK [debug] 
*******************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => (item={'name': 'nginx_url', 'dev': 'value_dev_url'}) => {
    "msg": "value_dev_url"
}
ok: [localhost] => (item={'name': 'nginx_conf', 'dev': 'value_dev_conf'}) 
=> {
    "msg": "value_dev_conf"
}

TASK [set_fact] 
****************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [debug] 
*******************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => (item={'name': 'nginx_url', 'dev': 'value_dev_url'}) => {
    "msg": "value_dev_url"
}
ok: [localhost] => (item={'name': 'nginx_conf', 'dev': 'value_dev_conf'}) 
=> {
    "msg": "value_dev_conf"
}

```

##### ACTUAL RESULTS
In the playbook, the first debug is working as expected.
The second part from "set_fact" should works like the first debug, but he 
doesn't.

I tried to use with_items, with_list, lookup, everything fail..

<!--- Paste verbatim command output between quotes -->
```paste below
TASK [debug] 
*******************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => (item={'name': 'nginx_url', 'dev': 'value_dev_url'}) => {
    "msg": "value_dev_url"
}
ok: [localhost] => (item={'name': 'nginx_conf', 'dev': 'value_dev_conf'}) 
=> {
    "msg": "value_dev_conf"
}

TASK [set_fact] 
****************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [debug] 
*******************************************************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'dict object' has no attribute 
'item.dev'\n\nThe error appears to have been in 
'/Users/guillaumedubroeucq/r3d/ansible-playbook/playbook.yml': line 24, 
column 5, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n  - debug:\n    ^ 
here\n"}

```

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a4700df5-37ab-4d26-83bb-d89595eb4b02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to