blob: fdc9e3a5c70552e27be953b3510fbe22696605f9 [file] [log] [blame]
Hung-Wei Chiu80dc18d2020-10-20 23:56:46 +00001---
2# jenkins tasks/main.yml
3#
4# SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
5# SPDX-License-Identifier: Apache-2.0
6
7- name: include OS-specific vars
8 include_vars: "{{ ansible_os_family }}.yml"
9
Hung-Wei Chiua5672f82020-10-23 21:50:56 +000010- name: Gather the package facts
11 package_facts:
12 manager: auto
13
Hung-Wei Chiu80dc18d2020-10-20 23:56:46 +000014- name: include OS-specific tasks
15 include_tasks: "{{ ansible_os_family }}.yml"
16
17- name: Initial the Jenkins
18 include_tasks: "settings.yml"
19
Hung-Wei Chiua5672f82020-10-23 21:50:56 +000020- name: Trigger handlers immediately in case Jenkins was installed
21 meta: flush_handlers
22
23- name: Wait for Jenkins to start up before proceeding.
24 uri:
25 url: "http://{{ jenkins_localhost }}/cli/"
26 method: GET
27 return_content: "yes"
28 timeout: 5
29 body_format: raw
30 follow_redirects: "no"
31 status_code: 200,403
32 register: result
33 until: (result.status == 403 or result.status == 200)
34 and (result.content.find("Please wait while") == -1)
35 retries: 60
36 delay: 5
37
38- name: Remove Jenkins security init scripts after first startup.
39 file:
40 path: "{{ jenkins_home }}/init.groovy.d/basic-security.groovy"
41 state: absent
Hung-Wei Chiu72e8f602020-11-06 22:02:09 +000042
43- name: Install plugins
44 jenkins_plugin:
45 name: "{{ item.name }}"
46 version: "{{ item.version | default(omit) }}"
47 url_username: "{{ jenkins_admin_username }}"
48 url_password: "{{ jenkins_admin_password }}"
49 url: "http://{{ jenkins_localhost }}"
50 register: my_jenkins_plugin_versioned
51 with_items: "{{ jenkins_plugins }}"
52 notify: restart-jenkins
53 register: plugin_result
54 until: plugin_result is success
55 retries: 3
56 delay: 2