Hung-Wei Chiu | 80dc18d | 2020-10-20 23:56:46 +0000 | [diff] [blame] | 1 | --- |
| 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 Chiu | a5672f8 | 2020-10-23 21:50:56 +0000 | [diff] [blame^] | 10 | - name: Gather the package facts |
| 11 | package_facts: |
| 12 | manager: auto |
| 13 | |
Hung-Wei Chiu | 80dc18d | 2020-10-20 23:56:46 +0000 | [diff] [blame] | 14 | - 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 Chiu | a5672f8 | 2020-10-23 21:50:56 +0000 | [diff] [blame^] | 20 | - 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 |