# How to retry within a with\_items loop ?

**URL:** <https://forum.ansible.com/t/how-to-retry-within-a-with-items-loop/27953>\
**Category:** Ansible Project\
**Created:** [July 5, 2018, 7:07am UTC](https://forum.ansible.com/t/how-to-retry-within-a-with-items-loop/27953 "2018-07-05T07:07:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JiElPe-Fr38](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@JiElPe-Fr38](https://forum.ansible.com/u/JiElPe-Fr38)\
**Post date:** [July 5, 2018, 7:07am UTC](https://forum.ansible.com/t/how-to-retry-within-a-with-items-loop/27953/1 "2018-07-05T07:07:07Z")

</div>

Hello,

I have written a task that installs jenkins plugins using the jenkins\_plugin module and a list of plugins.  
It looks like :

`

- name: Install plugins  
jenkins\_plugin:  
group: “{{ jenkins\_process\_group }}”  
owner: “{{ jenkins\_process\_user }}”  
name: “{{ item }}”  
state: present # Should be latest: but see issue [https://github.com/ansible/ansible/issues/24864](https://github.com/ansible/ansible/issues/24864)  
timeout: 120  
url: “{{ jenkinsHTTPSURL }}”  
url\_username: “{{ jenkinsAdmName }}”  
url\_password: “{{ jenkinsAdmPwd }}”  
with\_dependencies: yes  
validate\_certs: no  
with\_items: “{{ jenkins\_plugins }}”  
retries: 3  
delay: 5

`

This runs correctly, but sometimes this or that plugin install fails mainly due to a network error.  
I’d like to add a retry as shown by the two last lines.  
But this does not work at all. When some error occurs, there is no retry.

Even though there is no syntax error, I guess that there is something wrong in the way I designed this task.

Thanks for your help.

Best Regards.  
J-L
