# with\_dict + conditional depending on item.value

**URL:** <https://forum.ansible.com/t/with-dict-conditional-depending-on-item-value/20198>\
**Category:** Ansible Project\
**Created:** [January 13, 2016, 2:21pm UTC](https://forum.ansible.com/t/with-dict-conditional-depending-on-item-value/20198 "2016-01-13T14:21:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomas\_Javier\_Garcia](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@Tomas\_Javier\_Garcia](https://forum.ansible.com/u/Tomas_Javier_Garcia)\
**Post date:** [January 13, 2016, 2:21pm UTC](https://forum.ansible.com/t/with-dict-conditional-depending-on-item-value/20198/1 "2016-01-13T14:21:19Z")

</div>

Hi,

I’ve been working on single and multiple wars deployment ansible scripts. To simplify teh mutiple I just created the vars/projectX.yml with the artifacts information so the ansible call doesn’t contain several parameters…

I’ve been able to pull the artifacts from nexus and deployed them, but I want to test the deployed apps only when an artifact’s variable value has been set, I just read about the "default{}"usage but what I need is to check a specific attribute over the iteration. is this possible?

tasks/test\_app\_multiple.yml:

- name: Checking if the application is running  
get\_url: url=http://{{ host\_ip.stdout }}:{{ application\_port }}/{{ item.value.application\_path }} dest=“/tmp”  
with\_dict: artifacts  
when: item.value.application\_path != “”

- For the record, I got a similar task but for single deploy without the "with\_dict"clause and it works with no issues, in that case the application\_path variable is provided in ansible-playbook call as argument…
