From 5f46719ad85b746f38c833124f6ac5a0cf5598fa Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 12 Feb 2020 18:04:39 +0100 Subject: [PATCH] Do not fail if a plugin do not install. --- library/roles/jenkins/common/tasks/main.yml | 2 ++ library/roles/jenkins/master/tasks/jenkins_plugins.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/library/roles/jenkins/common/tasks/main.yml b/library/roles/jenkins/common/tasks/main.yml index 12434ca7..a046844b 100644 --- a/library/roles/jenkins/common/tasks/main.yml +++ b/library/roles/jenkins/common/tasks/main.yml @@ -18,6 +18,8 @@ user: name={{ jenkins_username }} generate_ssh_key=True delegate_to: '{{ item }}' with_items: '{{ groups.jenkins_master }}' + when: ansible_fqdn == '{{ jenkins_master_hostname }}' + run_once: True - name: Get the master ssh keys become: True diff --git a/library/roles/jenkins/master/tasks/jenkins_plugins.yml b/library/roles/jenkins/master/tasks/jenkins_plugins.yml index 79dd3e32..045585e1 100644 --- a/library/roles/jenkins/master/tasks/jenkins_plugins.yml +++ b/library/roles/jenkins/master/tasks/jenkins_plugins.yml @@ -35,12 +35,14 @@ when: item.version is not defined with_items: '{{ jenkins_plugins }}' notify: Restart jenkins + ignore_errors: True - name: Install plugins with a specific version jenkins_plugin: name="{{ item.name }}" state={{ item.state | default('latest') }} version='{{ item.version }}' url={{ jenkins_local_url }} url_username={{ jenkins_access_params.url_username }} url_password={{ jenkins_access_params.url_password }} when: item.version is defined with_items: '{{ jenkins_plugins }}' notify: Restart jenkins + ignore_errors: True become: True become_user: '{{ jenkins_username }}'