Using ignore_errors : yes in loop

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}}”
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

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

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
        Racke