# advice about "with\_dict" and condicional correct way to use

**URL:** <https://forum.ansible.com/t/advice-about-with-dict-and-condicional-correct-way-to-use/19103>\
**Category:** Ansible Project\
**Created:** [August 24, 2015, 10:02pm UTC](https://forum.ansible.com/t/advice-about-with-dict-and-condicional-correct-way-to-use/19103 "2015-08-24T22:02:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Alejandro](https://forum.ansible.com/u/Alejandro)\
**Post date:** [August 24, 2015, 10:02pm UTC](https://forum.ansible.com/t/advice-about-with-dict-and-condicional-correct-way-to-use/19103/1 "2015-08-24T22:02:18Z")

</div>

Hi all,

I has this error:

`  
UndefinedError: ‘dict’ object has no attribute ‘JMSFileStoreName’

`

Into my dict just a few has this attributes, others not, I’ll like to execute some task in case that this atribute exist, some way to check the status to avoid break the playbook?

This is my task:

`

- stat: path=“/tmp/{{ item.key }}{{ server.sufix }}\_{{item.value.JMSFileStoreName}}.py”  
register: config\_jms  
with\_dict: “{{AppName}}”  
when: “{{item.value.JMSFileStoreName}} is defined”  
tags: config\_jms  
`

thanks for any advice!  
Ale

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [August 24, 2015, 10:41pm UTC](https://forum.ansible.com/t/advice-about-with-dict-and-condicional-correct-way-to-use/19103/2 "2015-08-24T22:41:24Z")

</div>

no moustaches in when and no chained defined using dot notation (.).

when: "'JMSFileStoreName' in item.value"
