# jenkins\_plugins mdule : error when playing again a playbook

**URL:** <https://forum.ansible.com/t/jenkins-plugins-mdule-error-when-playing-again-a-playbook/30639>\
**Category:** Ansible Project\
**Created:** [June 24, 2019, 9:48am UTC](https://forum.ansible.com/t/jenkins-plugins-mdule-error-when-playing-again-a-playbook/30639 "2019-06-24T09:48:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JiElPe-Fr381](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@JiElPe-Fr381](https://forum.ansible.com/u/JiElPe-Fr381)\
**Post date:** [June 24, 2019, 9:48am UTC](https://forum.ansible.com/t/jenkins-plugins-mdule-error-when-playing-again-a-playbook/30639/1 "2019-06-24T09:48:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JiElPe-Fr381](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@JiElPe-Fr381](https://forum.ansible.com/u/JiElPe-Fr381)\
**Post date:** [June 24, 2019, 1:38pm UTC](https://forum.ansible.com/t/jenkins-plugins-mdule-error-when-playing-again-a-playbook/30639/2 "2019-06-24T13:38:20Z")

</div>

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 😉  
This question is closed.

Best Regards.  
J-L
