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: |
| 10 | - name: Install apt packages |
| 11 | apt: |
| 12 | name: |
| 13 | - "facter" |
| 14 | - "libxml2-utils" |
| 15 | - "bzip2" |
| 16 | - "curl" |
| 17 | - "ebtables" |
| 18 | - "enchant" |
| 19 | - "ethtool" |
| 20 | - "git" |
| 21 | - "graphviz" |
| 22 | - "jq" |
| 23 | - "kafkacat" |
| 24 | - "less" |
| 25 | - "libpcap-dev" |
| 26 | - "libxml2-utils" |
| 27 | - "maven" |
| 28 | - "ruby" |
| 29 | - "screen" |
| 30 | - "socat" |
| 31 | - "ssh" |
| 32 | - "sshpass" |
| 33 | - "zip" |
| 34 | # below four packages are required by npm |
| 35 | - "nodejs" |
| 36 | - "libssl1.0-dev" |
| 37 | - "nodejs-dev" |
| 38 | - "node-gyp" |
| 39 | - "npm" |
| 40 | state: "present" |
| 41 | update_cache: true |
| 42 | cache_valid_time: 3600 |
| 43 | |
| 44 | - name: Download repo launcher |
| 45 | get_url: |
| 46 | url: "https://gerrit.googlesource.com/git-repo/+/refs/tags/v2.12.2/repo?format=TEXT" |
| 47 | checksum: "sha256:f5afffcc9afae128efd2b325ff19544a0b78acceb33a2edf368ce2de94e8c33e" |
| 48 | dest: /tmp/repo.b64 |
| 49 | |
| 50 | - name: Decode and make repo launcher executable |
| 51 | shell: |
| 52 | cmd: | |
| 53 | base64 --decode /tmp/repo.b64 > /usr/local/bin/repo; |
| 54 | chmod 755 /usr/local/bin/repo |
| 55 | creates: /usr/local/bin/repo |
| 56 | |
| 57 | - name: Download helm archive |
| 58 | get_url: |
| 59 | url: "https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz" |
| 60 | checksum: "sha256:01b317c506f8b6ad60b11b1dc3f093276bb703281cb1ae01132752253ec706a2" |
| 61 | dest: "/tmp/helm.tgz" |
| 62 | |
| 63 | - name: Unarchive helm |
| 64 | unarchive: |
| 65 | src: "/tmp/helm.tgz" |
| 66 | dest: "/tmp" |
| 67 | remote_src: yes |
| 68 | |
| 69 | - name: Install helm binary |
| 70 | copy: |
| 71 | src: /tmp/linux-amd64/helm |
| 72 | dest: /usr/local/bin/helm |
| 73 | mode: "0755" |
| 74 | remote_src: yes |
| 75 | |
| 76 | - name: Download/install kubectl binary |
| 77 | get_url: |
| 78 | url: "https://storage.googleapis.com/kubernetes-release/release/v1.18.15/bin/linux/amd64/kubectl" |
| 79 | checksum: "sha256:eb5a5dd0a72795942ab81d1e4331625e80a90002c8bb39b2cb15aa707a3812c6" |
| 80 | dest: /usr/local/bin/kubectl |
| 81 | mode: "0755" |
| 82 | |
| 83 | - name: load /etc/docker/daemon.json from file |
| 84 | slurp: |
| 85 | src: /etc/docker/daemon.json |
| 86 | register: imported_var |
| 87 | |
| 88 | - name: append more key/values |
| 89 | set_fact: |
| 90 | imported_var: "{{ imported_var.content|b64decode|from_json | default([]) | combine({ 'registry-mirrors': ['https://mirror.registry.opennetworking.org'] }) }}" |
| 91 | |
| 92 | - name: write var to file |
| 93 | copy: |
| 94 | content: "{{ imported_var | to_nice_json }}" |
| 95 | dest: /etc/docker/daemon.json |
| 96 | |
| 97 | - name: restart Docker service |
| 98 | systemd: |
| 99 | name: docker |
| 100 | state: restarted |
| 101 | daemon_reload: true |
| 102 | |
| 103 | - name: Install multi python3 packages with version specifiers |
| 104 | pip: |
| 105 | name: |
| 106 | - ansible |
| 107 | - ansible-lint |
| 108 | - docker |
| 109 | - docker-compose |
| 110 | - git-review |
| 111 | - httpie |
| 112 | - netaddr |
| 113 | - pylint |
| 114 | - tox |
| 115 | - twine |
| 116 | - virtualenv |
| 117 | - yamllint |
| 118 | executable: pip3 |
| 119 | - name: Install multi python2 packages with version specifiers |
| 120 | pip: |
| 121 | name: |
| 122 | - Jinja2 |
| 123 | - coverage |
| 124 | - certifi |
| 125 | - cryptography |
| 126 | - git+https://github.com/linkchecker/linkchecker.git@v9.4.0 |
| 127 | - graphviz |
| 128 | - isort |
| 129 | - more-itertools==5.0.0 |
| 130 | - mock>2.0.0<2.1.0 |
| 131 | - ndg-httpsclient |
| 132 | - nose2>0.9.0<0.10.0 |
| 133 | - pyopenssl |
| 134 | - pexpect |
| 135 | - pyyaml>3.10.0<3.11.0 |
| 136 | - requests>2.14.0<2.15.0 |
| 137 | - robotframework |
| 138 | - robotframework-httplibrary |
| 139 | - robotframework-kafkalibrary |
| 140 | - robotframework-lint |
| 141 | - robotframework-requests |
| 142 | - robotframework-sshlibrary |
| 143 | - six |
| 144 | - urllib3 |
| 145 | |
| 146 | - name: Install multi ruby packages with version specifiers |
| 147 | gem: |
| 148 | name: mdl |
| 149 | version: 0.5.0 |
| 150 | |
| 151 | - name: Install gitbook-cli npm package with version specifiers |
| 152 | npm: |
| 153 | name: gitbook-cli |
| 154 | global: true |
| 155 | |
| 156 | - name: Install markdownlint npm package with version specifiers |
| 157 | npm: |
| 158 | name: markdownlint |
| 159 | global: true |
| 160 | |
| 161 | - name: Install typings npm package with version specifiers |
| 162 | npm: |
| 163 | name: typings |
| 164 | global: true |
| 165 | |
| 166 | - name: Download minikube |
| 167 | get_url: |
| 168 | url: "https://storage.googleapis.com/minikube/releases/latest/minikube_1.18.0-0_amd64.deb" |
| 169 | checksum: "sha256:6e3918b601704014f3d0b0a09e3116f1ea528ac255525743a800b5f0b5856622" |
| 170 | dest: /tmp/minikube.deb |
| 171 | |
| 172 | - name: Install minikube deb |
| 173 | apt: |
| 174 | deb: /tmp/minikube.deb |
| 175 | |
| 176 | - name: Download protobuf |
| 177 | get_url: |
| 178 | url: "https://github.com/google/protobuf/releases/download/v3.7.0/protoc-3.7.0-linux-x86_64.zip" |
| 179 | checksum: "sha256:a1b8ed22d6dc53c5b8680a6f1760a305b33ef471bece482e92728f00ba2a2969" |
| 180 | dest: /tmp/protobuf.zip |
| 181 | |
| 182 | - name: Unarchive protobuf |
| 183 | unarchive: |
| 184 | src: "/tmp/protobuf.zip" |
| 185 | dest: "/usr/local" |
| 186 | remote_src: yes |
| 187 | |
| 188 | - name: Download pandoc |
| 189 | get_url: |
| 190 | url: "https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb" |
| 191 | checksum: "sha256:4515d6fe2bf8b82765d8dfa1e1b63ccb0ff3332d60389f948672eaa37932e936" |
| 192 | dest: /tmp/pandoc.deb |
| 193 | |
| 194 | - name: Install pandoc deb |
| 195 | apt: |
| 196 | deb: /tmp/pandoc.deb |
| 197 | |
| 198 | - name: Download yq |
| 199 | get_url: |
| 200 | url: "https://github.com/mikefarah/yq/releases/download/3.4.0/yq_linux_amd64" |
| 201 | checksum: "sha256:f6bd1536a743ab170b35c94ed4c7c4479763356bd543af5d391122f4af852460" |
| 202 | dest: /usr/local/bin/yq |
| 203 | |
| 204 | - name: Change yq Permission |
| 205 | file: |
| 206 | path: /usr/local/bin/yq |
| 207 | mode: 0755 |
| 208 | |
| 209 | - name: Download hadolint |
| 210 | get_url: |
| 211 | url: "https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-Linux-x86_64" |
| 212 | checksum: "sha256:f9bc9de12438b463ca84e77fde70b07b155d4da07ca21bc3f4354a62c6199db4" |
| 213 | dest: /usr/local/bin/hadolint |
| 214 | |
| 215 | - name: Change hadolint Permission |
| 216 | file: |
| 217 | path: /usr/local/bin/hadolint |
| 218 | mode: 0755 |
| 219 | |
| 220 | - name: Recursively remove download files and folders |
| 221 | file: |
| 222 | path: "{{ item }}" |
| 223 | state: absent |
| 224 | with_items: |
| 225 | - /tmp/linux-amd64 |
| 226 | - /tmp/helm.tgz |
| 227 | - /tmp/minikube.deb |
| 228 | - /tmp/protobuf.zip |
| 229 | - /tmp/pandoc.deb |
| 230 | - /tmp/repo.b64 |
| 231 | - /tmp/golang_1.16.3.tar.gz |