jenkins_plugins mdule : error when playing again a playbook

Dear all,

I have a problem with the jenkins_plugins module.

Within a playbook that pull a jenkins docker image (jenkins/jenkins:lts-alpine) and runs it to install the instance and configure it, I have a task that install a list of plugins on an instance, which is :

`

  • name: Install plugins
    jenkins_plugin:
    owner: “{{ jenkins_process_user }}”
    group: “{{ jenkins_process_group }}”
    name: “{{ item }}”
    state: latest
    timeout: 120
    url: “http://{{ jenkins_hostname }}:{{ jenkins_http_port }}{{ jenkins_url_prefix }}”
    url_username: “{{ jenkins_admin_name }}”
    url_password: “{{ jenkins_admin_password }}”
    with_dependencies: yes
    loop: “{{ jenkinsPlugins }}”
    register: pluginResult
    until: not pluginResult.failed
    retries: 5
    notify: restart_image
    become: True
    become_user: “{{ jenkins_process_user }}”
    `

It works correctly when the playbook is run for the first time.
All plugins are installed, and possibly retried in case of problem.

But, when I relaunch exactly the same playbook, Each and every plugin installation is retried up to the max nbr of retry and fails with (for example):

`
failed: [devEnv] (item=blueocean) => {“ansible_loop_var”: “item”, “attempts”: 5, “changed”: false, “item”: “blueocean”, “msg”: “Jenkins home directory doesn’t exist.”}

`

For sure, I have verified that the jenkins home directory actually exists and has the awaited "{{ jenkins_process_user }}" and
"{{ jenkins_process_group }}" owner and group, which is jenkins:jenkins.

I really cannot explain why I get this error, which clearly makes this playbook not idempotent !

For sure, I can give the whole playbook if you need additional information.

Thanks for your help.
J-L

Finally, I have found the problem… something like between keyboard and chair …
I simply forget to set the jenkins_home (default to /var/lib/jenkins) which is actually /var/lib/jenkins within the container, but /home/jenkins/jenkins_home on the ansible controler machine which is the ansible target for the playbook.

So, thanks for your help :wink:
This question is closed.

Best Regards.
J-L