Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 1 | --- |
Joey Armstrong | 518f357 | 2024-02-11 07:56:25 -0500 | [diff] [blame] | 2 | # SPDX-FileCopyrightText: 2020-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 3 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
| 4 | |
| 5 | - name: "Provision Packages for Jenkins image" |
| 6 | hosts: default |
| 7 | become: true |
| 8 | |
| 9 | tasks: |
Hung-Wei Chiu | bfa8fe3 | 2021-04-27 10:59:40 -0700 | [diff] [blame] | 10 | - name: Add Java Amazon Corretto Jdk repo GPG key |
| 11 | apt_key: |
| 12 | url: https://apt.corretto.aws/corretto.key |
| 13 | state: present |
| 14 | |
| 15 | - name: Add Java Amazon Corretto Jdk repo |
| 16 | apt_repository: |
| 17 | repo: deb https://apt.corretto.aws stable main |
| 18 | state: present |
| 19 | |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 20 | - name: Install apt packages |
| 21 | apt: |
| 22 | name: |
| 23 | - "facter" |
| 24 | - "libxml2-utils" |
| 25 | - "bzip2" |
| 26 | - "curl" |
| 27 | - "ebtables" |
| 28 | - "enchant" |
| 29 | - "ethtool" |
| 30 | - "git" |
| 31 | - "graphviz" |
| 32 | - "jq" |
| 33 | - "kafkacat" |
| 34 | - "less" |
| 35 | - "libpcap-dev" |
| 36 | - "libxml2-utils" |
| 37 | - "maven" |
| 38 | - "ruby" |
| 39 | - "screen" |
| 40 | - "socat" |
| 41 | - "ssh" |
| 42 | - "sshpass" |
| 43 | - "zip" |
| 44 | # below four packages are required by npm |
| 45 | - "nodejs" |
| 46 | - "libssl1.0-dev" |
| 47 | - "nodejs-dev" |
| 48 | - "node-gyp" |
| 49 | - "npm" |
Hung-Wei Chiu | bfa8fe3 | 2021-04-27 10:59:40 -0700 | [diff] [blame] | 50 | - "java-1.8.0-amazon-corretto-jdk" |
| 51 | - "java-11-amazon-corretto-jdk" |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 52 | state: "present" |
| 53 | update_cache: true |
| 54 | cache_valid_time: 3600 |
| 55 | |
| 56 | - name: Download repo launcher |
| 57 | get_url: |
| 58 | url: "https://gerrit.googlesource.com/git-repo/+/refs/tags/v2.12.2/repo?format=TEXT" |
| 59 | checksum: "sha256:f5afffcc9afae128efd2b325ff19544a0b78acceb33a2edf368ce2de94e8c33e" |
| 60 | dest: /tmp/repo.b64 |
| 61 | |
| 62 | - name: Decode and make repo launcher executable |
| 63 | shell: |
| 64 | cmd: | |
| 65 | base64 --decode /tmp/repo.b64 > /usr/local/bin/repo; |
| 66 | chmod 755 /usr/local/bin/repo |
| 67 | creates: /usr/local/bin/repo |
| 68 | |
| 69 | - name: Download helm archive |
| 70 | get_url: |
| 71 | url: "https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz" |
| 72 | checksum: "sha256:01b317c506f8b6ad60b11b1dc3f093276bb703281cb1ae01132752253ec706a2" |
| 73 | dest: "/tmp/helm.tgz" |
| 74 | |
| 75 | - name: Unarchive helm |
| 76 | unarchive: |
| 77 | src: "/tmp/helm.tgz" |
| 78 | dest: "/tmp" |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 79 | remote_src: true |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 80 | |
| 81 | - name: Install helm binary |
| 82 | copy: |
| 83 | src: /tmp/linux-amd64/helm |
| 84 | dest: /usr/local/bin/helm |
| 85 | mode: "0755" |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 86 | remote_src: true |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 87 | |
| 88 | - name: Download/install kubectl binary |
| 89 | get_url: |
| 90 | url: "https://storage.googleapis.com/kubernetes-release/release/v1.18.15/bin/linux/amd64/kubectl" |
| 91 | checksum: "sha256:eb5a5dd0a72795942ab81d1e4331625e80a90002c8bb39b2cb15aa707a3812c6" |
| 92 | dest: /usr/local/bin/kubectl |
| 93 | mode: "0755" |
| 94 | |
| 95 | - name: load /etc/docker/daemon.json from file |
| 96 | slurp: |
| 97 | src: /etc/docker/daemon.json |
| 98 | register: imported_var |
| 99 | |
| 100 | - name: append more key/values |
| 101 | set_fact: |
| 102 | imported_var: "{{ imported_var.content|b64decode|from_json | default([]) | combine({ 'registry-mirrors': ['https://mirror.registry.opennetworking.org'] }) }}" |
| 103 | |
| 104 | - name: write var to file |
| 105 | copy: |
| 106 | content: "{{ imported_var | to_nice_json }}" |
| 107 | dest: /etc/docker/daemon.json |
| 108 | |
| 109 | - name: restart Docker service |
| 110 | systemd: |
| 111 | name: docker |
| 112 | state: restarted |
| 113 | daemon_reload: true |
| 114 | |
| 115 | - name: Install multi python3 packages with version specifiers |
| 116 | pip: |
| 117 | name: |
| 118 | - ansible |
| 119 | - ansible-lint |
| 120 | - docker |
| 121 | - docker-compose |
| 122 | - git-review |
| 123 | - httpie |
| 124 | - netaddr |
| 125 | - pylint |
| 126 | - tox |
| 127 | - twine |
| 128 | - virtualenv |
| 129 | - yamllint |
| 130 | executable: pip3 |
| 131 | - name: Install multi python2 packages with version specifiers |
| 132 | pip: |
| 133 | name: |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 134 | - Jinja2 |
| 135 | - coverage |
| 136 | - certifi |
| 137 | - cryptography |
| 138 | - git+https://github.com/linkchecker/linkchecker.git@v9.4.0 |
| 139 | - graphviz |
| 140 | - isort |
| 141 | - more-itertools==5.0.0 |
| 142 | - mock>2.0.0<2.1.0 |
| 143 | - ndg-httpsclient |
| 144 | - nose2>0.9.0<0.10.0 |
| 145 | - pyopenssl |
| 146 | - pexpect |
| 147 | - pyyaml>3.10.0<3.11.0 |
| 148 | - requests>2.14.0<2.15.0 |
| 149 | - robotframework |
| 150 | - robotframework-httplibrary |
| 151 | - robotframework-kafkalibrary |
| 152 | - robotframework-lint |
| 153 | - robotframework-requests |
| 154 | - robotframework-sshlibrary |
| 155 | - six |
| 156 | - urllib3 |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 157 | |
| 158 | - name: Install multi ruby packages with version specifiers |
| 159 | gem: |
| 160 | name: mdl |
| 161 | version: 0.5.0 |
| 162 | |
| 163 | - name: Install gitbook-cli npm package with version specifiers |
| 164 | npm: |
| 165 | name: gitbook-cli |
| 166 | global: true |
| 167 | |
| 168 | - name: Install markdownlint npm package with version specifiers |
| 169 | npm: |
| 170 | name: markdownlint |
Jan Klare | ca3e729 | 2023-09-29 13:02:53 +0200 | [diff] [blame] | 171 | version: '0.18.0' |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 172 | global: true |
| 173 | |
| 174 | - name: Install typings npm package with version specifiers |
| 175 | npm: |
| 176 | name: typings |
| 177 | global: true |
| 178 | |
| 179 | - name: Download minikube |
| 180 | get_url: |
| 181 | url: "https://storage.googleapis.com/minikube/releases/latest/minikube_1.18.0-0_amd64.deb" |
| 182 | checksum: "sha256:6e3918b601704014f3d0b0a09e3116f1ea528ac255525743a800b5f0b5856622" |
| 183 | dest: /tmp/minikube.deb |
| 184 | |
| 185 | - name: Install minikube deb |
| 186 | apt: |
| 187 | deb: /tmp/minikube.deb |
| 188 | |
| 189 | - name: Download protobuf |
| 190 | get_url: |
| 191 | url: "https://github.com/google/protobuf/releases/download/v3.7.0/protoc-3.7.0-linux-x86_64.zip" |
| 192 | checksum: "sha256:a1b8ed22d6dc53c5b8680a6f1760a305b33ef471bece482e92728f00ba2a2969" |
| 193 | dest: /tmp/protobuf.zip |
| 194 | |
| 195 | - name: Unarchive protobuf |
| 196 | unarchive: |
| 197 | src: "/tmp/protobuf.zip" |
| 198 | dest: "/usr/local" |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 199 | remote_src: true |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 200 | |
| 201 | - name: Download pandoc |
| 202 | get_url: |
| 203 | url: "https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb" |
| 204 | checksum: "sha256:4515d6fe2bf8b82765d8dfa1e1b63ccb0ff3332d60389f948672eaa37932e936" |
| 205 | dest: /tmp/pandoc.deb |
| 206 | |
| 207 | - name: Install pandoc deb |
| 208 | apt: |
| 209 | deb: /tmp/pandoc.deb |
| 210 | |
| 211 | - name: Download yq |
| 212 | get_url: |
| 213 | url: "https://github.com/mikefarah/yq/releases/download/3.4.0/yq_linux_amd64" |
| 214 | checksum: "sha256:f6bd1536a743ab170b35c94ed4c7c4479763356bd543af5d391122f4af852460" |
| 215 | dest: /usr/local/bin/yq |
| 216 | |
| 217 | - name: Change yq Permission |
| 218 | file: |
| 219 | path: /usr/local/bin/yq |
| 220 | mode: 0755 |
| 221 | |
| 222 | - name: Download hadolint |
| 223 | get_url: |
| 224 | url: "https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-Linux-x86_64" |
| 225 | checksum: "sha256:f9bc9de12438b463ca84e77fde70b07b155d4da07ca21bc3f4354a62c6199db4" |
| 226 | dest: /usr/local/bin/hadolint |
| 227 | |
| 228 | - name: Change hadolint Permission |
| 229 | file: |
| 230 | path: /usr/local/bin/hadolint |
| 231 | mode: 0755 |
| 232 | |
Hung-Wei Chiu | 61e8571 | 2021-04-29 11:16:24 -0700 | [diff] [blame] | 233 | - name: Download github-release |
| 234 | get_url: |
| 235 | url: "https://github.com/github-release/github-release/releases/download/v0.10.0/linux-amd64-github-release.bz2" |
| 236 | checksum: "sha256:b360af98188c5988314d672bb604efd1e99daae3abfb64d04051ee17c77f84b6" |
| 237 | dest: /tmp/github-release.bz2 |
| 238 | |
| 239 | |
| 240 | # Unarchive target doesn't support the bz2 format |
| 241 | - name: Unarchive github-release |
| 242 | shell: |
| 243 | cmd: | |
| 244 | bzip2 -d /tmp/github-release.bz2 |
| 245 | |
| 246 | - name: Install github-release binary |
| 247 | copy: |
| 248 | src: /tmp/github-release |
| 249 | dest: /usr/local/bin/github-release |
| 250 | mode: "0755" |
Joey Armstrong | 3f575f7 | 2023-01-15 23:49:19 -0500 | [diff] [blame] | 251 | remote_src: true |
Hung-Wei Chiu | 61e8571 | 2021-04-29 11:16:24 -0700 | [diff] [blame] | 252 | |
Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 253 | - name: Recursively remove download files and folders |
| 254 | file: |
| 255 | path: "{{ item }}" |
| 256 | state: absent |
| 257 | with_items: |
| 258 | - /tmp/linux-amd64 |
| 259 | - /tmp/helm.tgz |
| 260 | - /tmp/minikube.deb |
| 261 | - /tmp/protobuf.zip |
| 262 | - /tmp/pandoc.deb |
| 263 | - /tmp/repo.b64 |
Joey Armstrong | af679da | 2023-01-31 14:22:41 -0500 | [diff] [blame] | 264 | |
| 265 | # [EOF] |