On 12/10/19 8:56 AM, Rahul Kumar wrote:
> 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

> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEwi%3DSAOTWHw1MnNHAbpqa0_8wUsaxQCEHU%3DKa%3DBM9gB5Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEwi%3DSAOTWHw1MnNHAbpqa0_8wUsaxQCEHU%3DKa%3DBM9gB5Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ab6b0b68-c240-66ee-fc13-bdb6f6e793bf%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to