| --- |
| # jenkins tasks/Debian.yml |
| # |
| # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| - name: Ensure dependencies are installed. |
| apt: |
| name: |
| - gnupg |
| - curl |
| - apt-transport-https |
| - openjdk-8-jdk |
| state: present |
| update_cache: true |
| |
| - name: Add Jenkins apt repo key |
| apt_key: |
| data: "{{ lookup('file','jenkins.io.key') }}" |
| state: "present" |
| |
| - name: Add Jenkins apt repo |
| apt_repository: |
| repo: "{{ jenkins_repo_url }}" |
| update_cache: true |
| |
| # We need to prepare both init groovy script and Jenkins setting before starting it. |
| - name: Mask the Jenkins to avoid it starting after first-time installation |
| systemd: |
| name: "{{ jenkins_service }}" |
| masked: true |
| when: "'jenkins' not in ansible_facts.packages" |
| |
| - name: Install Jenkins packages (Debian) |
| apt: |
| name: "jenkins" |
| state: "present" |
| update_cache: true |
| cache_valid_time: 3600 |
| notify: |
| - start-jenkins |