# Using ignore\_errors : yes in loop

**URL:** <https://forum.ansible.com/t/using-ignore-errors-yes-in-loop/31794>\
**Category:** Ansible Project\
**Created:** [December 10, 2019, 7:56am UTC](https://forum.ansible.com/t/using-ignore-errors-yes-in-loop/31794 "2019-12-10T07:56:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [December 10, 2019, 7:56am UTC](https://forum.ansible.com/t/using-ignore-errors-yes-in-loop/31794/1 "2019-12-10T07:56:56Z")

</div>

Hi Dick and Ansible gurus,  
I want to continue to other items of loop even if any of the item is failed in loop(probably we did not define that item and because of that - item failed, in that case it should continue to remaining items). How can we use ignore\_errors:yes which applies to all items in loop.  
Below is snippet :  
name: Application Configuration  
uri:  
url: http://{{ my\_ip | default(ansible\_fqdn) }}:{{8080 + (instance\_id | int -1)\*100}}/my-config/rest/{{item.resource}}  
body\_format: json  
method: PUT  
body: “{{[item.name](http://item.name)}}”  
user: “{{ app\_user }}”  
password: “{{ api\_password }}”  
force\_basic\_auth: true  
follow\_redirects: all  
with\_items:

- { name: ‘{{item1cfg}}’, resource: ‘item1’ }
- { name: ‘{{item2cfg}}’, resource: ‘item2’ }
- { name: ‘{{item3cfg}}’, resource: ‘item3’ }  
when: item1cfg is defined or item2cfg is defined or item3cfg is defined  
ignore\_errors: yes

Rahul

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [December 10, 2019, 8:08am UTC](https://forum.ansible.com/t/using-ignore-errors-yes-in-loop/31794/2 "2019-12-10T08:08:12Z")

</div>

> Hi Dick and Ansible gurus,  
> I want to continue to other items of loop even if any of the item is failed in loop(probably we did not define that item  
> and because of that - item failed, in that case it should continue to remaining items). How can we use ignore\_errors:yes  
> which applies to all items in loop.  
> Below is snippet :  
> name: Application Configuration  
> uri:  
> url: http://{{ my\_ip | default(ansible\_fqdn) }}:{{8080 + (instance\_id | int -1)\*100}}/my-config/rest/{{item.resource}}  
> body\_format: json  
> method: PUT  
> body: "{{item.name \<[http://item.name](http://item.name)\>}}"  
> user: "{{ app\_user }}"  
> password: "{{ api\_password }}"  
> force\_basic\_auth: true  
> follow\_redirects: all  
> with\_items:  
> - { name: '{{item1cfg}}', resource: 'item1' }  
> - { name: '{{item2cfg}}', resource: 'item2' }  
> - { name: '{{item3cfg}}', resource: 'item3' }  
> when: item1cfg is defined or item2cfg is defined or item3cfg is defined  
> ignore\_errors: yes
> 
> Rahul

This doesn't make much sense to me ... you should know which items exists.

But try failed\_when: ... this will be applied for every item in the loop.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
