diff --git a/library/roles/jenkins/common/tasks/main.yml b/library/roles/jenkins/common/tasks/main.yml index 12434ca..a046844 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 79dd3e3..045585e 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 }}'