Hung-Wei Chiu | 9708ed8 | 2021-04-14 14:20:08 -0700 | [diff] [blame] | 1 | --- |
| 2 | # SPDX-FileCopyrightText: 2020 Open Networking Foundation <info@opennetworking.org> |
| 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" |
| 79 | remote_src: yes |
| 80 | |
| 81 | - name: Install helm binary |
| 82 | copy: |
| 83 | src: /tmp/linux-amd64/helm |
| 84 | dest: /usr/local/bin/helm |
| 85 | mode: "0755" |
| 86 | remote_src: yes |
| 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: |
| 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 |
| 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 |
| 171 | global: true |
| 172 | |
| 173 | - name: Install typings npm package with version specifiers |
| 174 | npm: |
| 175 | name: typings |
| 176 | global: true |
| 177 | |
| 178 | - name: Download minikube |
| 179 | get_url: |
| 180 | url: "https://storage.googleapis.com/minikube/releases/latest/minikube_1.18.0-0_amd64.deb" |
| 181 | checksum: "sha256:6e3918b601704014f3d0b0a09e3116f1ea528ac255525743a800b5f0b5856622" |
| 182 | dest: /tmp/minikube.deb |
| 183 | |
| 184 | - name: Install minikube deb |
| 185 | apt: |
| 186 | deb: /tmp/minikube.deb |
| 187 | |
| 188 | - name: Download protobuf |
| 189 | get_url: |
| 190 | url: "https://github.com/google/protobuf/releases/download/v3.7.0/protoc-3.7.0-linux-x86_64.zip" |
| 191 | checksum: "sha256:a1b8ed22d6dc53c5b8680a6f1760a305b33ef471bece482e92728f00ba2a2969" |
| 192 | dest: /tmp/protobuf.zip |
| 193 | |
| 194 | - name: Unarchive protobuf |
| 195 | unarchive: |
| 196 | src: "/tmp/protobuf.zip" |
| 197 | dest: "/usr/local" |
| 198 | remote_src: yes |
| 199 | |
| 200 | - name: Download pandoc |
| 201 | get_url: |
| 202 | url: "https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb" |
| 203 | checksum: "sha256:4515d6fe2bf8b82765d8dfa1e1b63ccb0ff3332d60389f948672eaa37932e936" |
| 204 | dest: /tmp/pandoc.deb |
| 205 | |
| 206 | - name: Install pandoc deb |
| 207 | apt: |
| 208 | deb: /tmp/pandoc.deb |
| 209 | |
| 210 | - name: Download yq |
| 211 | get_url: |
| 212 | url: "https://github.com/mikefarah/yq/releases/download/3.4.0/yq_linux_amd64" |
| 213 | checksum: "sha256:f6bd1536a743ab170b35c94ed4c7c4479763356bd543af5d391122f4af852460" |
| 214 | dest: /usr/local/bin/yq |
| 215 | |
| 216 | - name: Change yq Permission |
| 217 | file: |
| 218 | path: /usr/local/bin/yq |
| 219 | mode: 0755 |
| 220 | |
| 221 | - name: Download hadolint |
| 222 | get_url: |
| 223 | url: "https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-Linux-x86_64" |
| 224 | checksum: "sha256:f9bc9de12438b463ca84e77fde70b07b155d4da07ca21bc3f4354a62c6199db4" |
| 225 | dest: /usr/local/bin/hadolint |
| 226 | |
| 227 | - name: Change hadolint Permission |
| 228 | file: |
| 229 | path: /usr/local/bin/hadolint |
| 230 | mode: 0755 |
| 231 | |
| 232 | - name: Recursively remove download files and folders |
| 233 | file: |
| 234 | path: "{{ item }}" |
| 235 | state: absent |
| 236 | with_items: |
| 237 | - /tmp/linux-amd64 |
| 238 | - /tmp/helm.tgz |
| 239 | - /tmp/minikube.deb |
| 240 | - /tmp/protobuf.zip |
| 241 | - /tmp/pandoc.deb |
| 242 | - /tmp/repo.b64 |
| 243 | - /tmp/golang_1.16.3.tar.gz |