How to retry within a with_items loop ?

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