├── VERSION ├── ngc ├── release.md ├── quickstart.md ├── version.json ├── metadata.json └── overview.md ├── .github ├── logo.jpg └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── playbooks ├── roles │ ├── install-nvidia-driver │ │ ├── files │ │ │ ├── cuda-ubuntu.pin │ │ │ └── cuda-vars.sh │ │ ├── tasks │ │ │ ├── main.yml │ │ │ └── install-ubuntu-driver.yml │ │ └── defaults │ │ │ └── main.yml │ ├── install-nvidia-docker │ │ ├── files │ │ │ └── daemon.json │ │ ├── tasks │ │ │ ├── main.yml │ │ │ ├── install-nvidia-docker.yml │ │ │ └── install-docker-ce.yml │ │ └── defaults │ │ │ └── main.yml │ ├── install-kubernetes │ │ ├── files │ │ │ ├── container_logs │ │ │ └── kube-flannel-rbac.yml │ │ ├── tasks │ │ │ ├── main.yml │ │ │ ├── swapoff.yml │ │ │ └── install-kubernetes.yml │ │ ├── defaults │ │ │ └── main.yml │ │ └── templates │ │ │ └── kube-flannel.j2 │ ├── install-clara-cli │ │ ├── templates │ │ │ └── ngc_config.j2 │ │ ├── tasks │ │ │ ├── main.yml │ │ │ ├── install-ngc-cli.yml │ │ │ └── install-clara-cli.yml │ │ └── defaults │ │ │ └── main.yml │ ├── remove-nvidia-driver │ │ ├── tasks │ │ │ ├── main.yml │ │ │ └── remove-ubuntu-driver.yml │ │ └── defaults │ │ │ └── main.yml │ ├── remove-kubernetes │ │ ├── tasks │ │ │ ├── main.yml │ │ │ └── remove-kubernetes.yml │ │ └── defaults │ │ │ └── main.yml │ ├── install-clara-components │ │ └── tasks │ │ │ ├── main.yml │ │ │ └── install-clara-components.yml │ ├── remove-clara-components │ │ └── tasks │ │ │ ├── main.yml │ │ │ └── remove-clara-components.yml │ ├── remove-clara-cli │ │ ├── defaults │ │ │ └── main.yml │ │ └── tasks │ │ │ ├── main.yml │ │ │ ├── remove-ngc-cli.yml │ │ │ └── remove-clara-cli.yml │ └── remove-nvidia-docker │ │ ├── tasks │ │ ├── main.yml │ │ ├── remove-docker-ce.yml │ │ └── remove-nvidia-docker.yml │ │ └── defaults │ │ └── main.yml ├── driver.yml ├── clara_hosts └── clara.yml ├── README.md ├── CONTRIBUTING.md └── LICENSE /VERSION: -------------------------------------------------------------------------------- 1 | 0.8.1 -------------------------------------------------------------------------------- /ngc/release.md: -------------------------------------------------------------------------------- 1 | # $BUILD_TAG -------------------------------------------------------------------------------- /.github/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NVIDIA/clara-platform-ansible-playbooks/main/.github/logo.jpg -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-driver/files/cuda-ubuntu.pin: -------------------------------------------------------------------------------- 1 | Package: * 2 | Pin: release l=NVIDIA CUDA 3 | Pin-Priority: 6001 -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-driver/files/cuda-vars.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export PATH="/usr/local/cuda/bin${PATH:+:${PATH}}" 4 | export LD_LIBRARY_PATH="/usr/local/cuda/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-docker/files/daemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "default-runtime": "nvidia", 3 | "runtimes": { 4 | "nvidia": { 5 | "path": "nvidia-container-runtime", 6 | "runtimeArgs": [] 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /playbooks/roles/install-kubernetes/files/container_logs: -------------------------------------------------------------------------------- 1 | /var/log/containers/*.log { 2 | rotate 10 3 | copytruncate 4 | missingok 5 | notifempty 6 | compress 7 | maxsize 100M 8 | dateext 9 | dateformat -%Y%m%d-%s 10 | create 0644 root root 11 | } 12 | -------------------------------------------------------------------------------- /playbooks/roles/install-clara-cli/templates/ngc_config.j2: -------------------------------------------------------------------------------- 1 | ;WARNING - This file is generated by an ansible script 2 | ;WARNING - To update local config settings, see "ngc config set -h" 3 | 4 | [CURRENT] 5 | apikey = {{ngc_api_key}} 6 | format_type = {{ngc_format}} 7 | org = {{ngc_org}} 8 | team = {{ngc_team}} -------------------------------------------------------------------------------- /ngc/quickstart.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | 1. Download the latest package and save it as `ansible.zip`. 4 | 2. Unzip `ansible.zip`: 5 | 6 | ``` bash 7 | unzip ansible.zip -d ansible 8 | ``` 9 | 10 | 3. Perform installation tasks as required by following instructions in the "Overview" section 11 | -------------------------------------------------------------------------------- /ngc/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "accuracyReached": 0, 3 | "batchSize": 0, 4 | "description": "$OVERVIEW_MD", 5 | "gpuModel": "Pascal and later", 6 | "versionId": "$BUILD_TAG", 7 | "memoryFootprint": "-", 8 | "numberOfEpochs": 0, 9 | "performance": "$PERFORMANCE_MD", 10 | "quickStartGuide": "$QUICKSTART_MD", 11 | "releaseNotes": "$RELEASE_MD", 12 | "setup": "$SETUP_MD" 13 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /playbooks/roles/remove-nvidia-driver/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Ubuntu Driver Removal Tasks 17 | include_tasks: remove-ubuntu-driver.yml 18 | -------------------------------------------------------------------------------- /playbooks/roles/remove-kubernetes/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - name: remove-kubernetes.yml Kubernetes 16 | include_tasks: remove-kubernetes.yml 17 | when: ansible_distribution == "Ubuntu" 18 | -------------------------------------------------------------------------------- /playbooks/roles/install-clara-components/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - name: Install Clara Platform 16 | include_tasks: install-clara-components.yml 17 | when: ansible_distribution == "Ubuntu" 18 | -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-driver/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Ubuntu Install Tasks 17 | include_tasks: install-ubuntu-driver.yml 18 | when: ansible_distribution == "Ubuntu" 19 | 20 | -------------------------------------------------------------------------------- /playbooks/roles/remove-clara-components/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Remove Clara Platform 17 | include_tasks: remove-clara-components.yml 18 | when: ansible_distribution == "Ubuntu" 19 | 20 | -------------------------------------------------------------------------------- /ngc/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "advanced": "$ADVANCED_MD", 3 | "application": "OTHER", 4 | "builtBy": "NVIDIA", 5 | "description": "$OVERVIEW_MD", 6 | "displayName": "Clara Deploy Ansible Installation", 7 | "labels": [ 8 | "Healthcare", 9 | "Clara Deploy", 10 | "Medical Imaging" 11 | ], 12 | "logo": "https://assets.nvidiagrid.net/ngc/logos/Clara.png", 13 | "modelFormat": "N/A", 14 | "name": "clara_ansible", 15 | "performance": "$PERFORMANCE_MD", 16 | "precision": "OTHER", 17 | "publicDatasetUsed": {}, 18 | "publisher": "NVIDIA", 19 | "quickStartGuide": "$QUICKSTART_MD", 20 | "relatedModels": [ 21 | ], 22 | "setup": "$SETUP_MD", 23 | "shortDescription": "The Clara Ansible installation package allows you to setup one or many systems with all dependencies required to run Clara Platform SDK", 24 | "trainingFramework": "Other" 25 | } -------------------------------------------------------------------------------- /playbooks/roles/install-kubernetes/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - name: Turn Swap Off 16 | include_tasks: swapoff.yml 17 | when: ansible_distribution == "Ubuntu" 18 | 19 | - name: Install Kubernetes 20 | include_tasks: install-kubernetes.yml 21 | -------------------------------------------------------------------------------- /playbooks/roles/remove-clara-cli/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | ngc_cli_url: 'https://ngc.nvidia.com/downloads/ngccli_cat_linux.zip' 17 | ngc_cli_dest: '/tmp/ngccli_cat_linux.zip' 18 | ngc_tmp_unpack: '/tmp/ngc' 19 | ngc_bin_path: '/usr/bin' 20 | -------------------------------------------------------------------------------- /playbooks/roles/install-clara-cli/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - name: Install NGC CLI 16 | include_tasks: install-ngc-cli.yml 17 | when: ansible_distribution == "Ubuntu" 18 | 19 | - name: Install Clara CLI 20 | include_tasks: install-clara-cli.yml 21 | when: ansible_distribution == "Ubuntu" -------------------------------------------------------------------------------- /playbooks/roles/remove-clara-cli/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Remove NGC CLI 17 | include_tasks: remove-ngc-cli.yml 18 | when: ansible_distribution == "Ubuntu" 19 | 20 | - name: Remove Clara CLI 21 | include_tasks: remove-clara-cli.yml 22 | when: ansible_distribution == "Ubuntu" -------------------------------------------------------------------------------- /playbooks/roles/remove-nvidia-docker/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - name: Remove Nvidia Docker 2 16 | include_tasks: remove-nvidia-docker.yml 17 | when: ansible_distribution == "Ubuntu" 18 | 19 | - name: Remove Docker CE 20 | include_tasks: remove-docker-ce.yml 21 | when: ansible_distribution == "Ubuntu" -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-docker/tasks/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - name: Install Docker CE 16 | include_tasks: install-docker-ce.yml 17 | when: ansible_distribution == "Ubuntu" 18 | 19 | - name: Install Nvidia Docker 2 20 | include_tasks: install-nvidia-docker.yml 21 | when: ansible_distribution == "Ubuntu" -------------------------------------------------------------------------------- /playbooks/roles/remove-clara-cli/tasks/remove-ngc-cli.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | 17 | - name: Remove NGC archive 18 | become: yes 19 | file: 20 | path: "{{ ngc_tmp_unpack }}" 21 | state: absent 22 | 23 | - name: Remove NGC binary 24 | ignore_errors: yes 25 | become: yes 26 | file: 27 | path: "{{ ngc_bin_path }}/ngc" 28 | state: absent -------------------------------------------------------------------------------- /playbooks/roles/remove-nvidia-docker/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | docker_ce_gpg: "https://download.docker.com/linux/ubuntu/gpg" 17 | docker_ce_repo: "deb https://download.docker.com/linux/ubuntu bionic stable" 18 | 19 | nvidia_docker_gpg: "https://nvidia.github.io/nvidia-docker/gpgkey" 20 | nvidia_docker_repo_dst: "/etc/apt/sources.list.d/nvidia-docker.list" -------------------------------------------------------------------------------- /playbooks/roles/remove-kubernetes/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | kubernetes_gpg_key: "https://packages.cloud.google.com/apt/doc/apt-key.gpg" 17 | kubernetes_repo: "deb http://apt.kubernetes.io/ kubernetes-xenial main" 18 | kubernetes_version: "1.15.4-00" 19 | helm_version: "2.15.2" 20 | helm_filename: "helm-v{{ helm_version }}-linux-amd64.tar.gz" 21 | helm_checksum: "sha256:a9d2db920bd4b3d824729bbe1ff3fa57ad27760487581af6e5d3156d1b3c2511" -------------------------------------------------------------------------------- /playbooks/roles/install-clara-cli/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | ngc_cli_url: 'https://ngc.nvidia.com/downloads/ngccli_cat_linux.zip' 17 | ngc_cli_dest: '/tmp/ngccli_cat_linux.zip' 18 | ngc_tmp_unpack: '/tmp/ngc' 19 | ngc_bin_path: '/usr/local/bin' 20 | ngc_format: 'ascii' 21 | 22 | # for the latest version of the Clara CLI 23 | cli_target: 'clara_cli' 24 | # for a specific version of the Clara CLI 25 | # cli_target: 'clara_cli:0.8.1-2101.1' 26 | -------------------------------------------------------------------------------- /playbooks/roles/install-clara-components/tasks/install-clara-components.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | 16 | - name: Pull Clara Components 17 | command: "clara pull -y {{ item }}" 18 | with_items: "{{ clara_components }}" 19 | become: false 20 | become_user: '{{ clara_user }}' 21 | 22 | - name: Start Clara Components 23 | command: "clara {{ item }} start" 24 | with_items: "{{ clara_components }}" 25 | become: false 26 | become_user: '{{ clara_user }}' -------------------------------------------------------------------------------- /playbooks/roles/install-kubernetes/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | kubernetes_gpg_key: "https://packages.cloud.google.com/apt/doc/apt-key.gpg" 15 | kubernetes_repo: "deb http://apt.kubernetes.io/ kubernetes-xenial main" 16 | kubernetes_version: "1.19.4-00" 17 | helm_version: "3.4.1" 18 | helm_filename: "helm-v{{ helm_version }}-linux-amd64.tar.gz" 19 | helm_checksum: "sha256:538f85b4b73ac6160b30fd0ab4b510441aa3fa326593466e8bf7084a9c288420" 20 | nvidia_device_plugin_version: "0.7.0" 21 | -------------------------------------------------------------------------------- /playbooks/roles/install-kubernetes/tasks/swapoff.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - name: Remove swapfile from /etc/fstab 16 | become: yes 17 | mount: 18 | name: "{{ item }}" 19 | fstype: swap 20 | state: absent 21 | with_items: 22 | - swap 23 | - none 24 | 25 | - name: check swap 26 | become: yes 27 | command: /sbin/swapon -s 28 | register: swapon 29 | changed_when: no 30 | 31 | - name: Disable swap 32 | become: yes 33 | command: /sbin/swapoff -a 34 | when: swapon.stdout -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Description 11 | A clear and concise description of what the bug is. 12 | 13 | ### Steps to reproduce 14 | Please share a clear and concise description of the problem. 15 | 16 | ... 17 | 18 | ### Expected behavior 19 | A clear and concise description of what you expected to happen. 20 | 21 | ### Actual behavior 22 | A clear and concise description of what actually happened. 23 | 24 | ### Configuration 25 | 26 | * Ansible version: 27 | * OS and version (distro if applicable): 28 | * Docker version (if applicable): 29 | * Installation source (NGC, Dockerhub, or something else): 30 | * Running playbook locally or remotely 31 | 32 | ### Regression? 33 | Did this work in the previous build or release of the playbook? If you can try a previous release or build to find out, that can help us narrow down the problem. If you don't know, that's OK. 34 | 35 | ### Other information 36 | (Please attach any relevant stdout / logs if available and remember to anonymize any PHI before sharing). 37 | -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-docker/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | docker_ce_gpg: "https://download.docker.com/linux/ubuntu/gpg" 16 | docker_ce_repo_bionic: "deb https://download.docker.com/linux/ubuntu bionic stable" 17 | docker_ce_repo_focal: "deb https://download.docker.com/linux/ubuntu focal stable" 18 | 19 | _ubuntu_repo_dir: "{{ ansible_distribution | lower }}{{ ansible_distribution_version }}" 20 | nvidia_docker_gpg: "https://nvidia.github.io/nvidia-docker/gpgkey" 21 | nvidia_docker_repo_src: "https://nvidia.github.io/nvidia-docker/{{ _ubuntu_repo_dir }}/nvidia-docker.list" 22 | nvidia_docker_repo_dst: "/etc/apt/sources.list.d/nvidia-docker.list" -------------------------------------------------------------------------------- /playbooks/driver.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - hosts: clara_hosts 16 | remote_user: "{{ clara_user }}" 17 | become: yes 18 | 19 | vars: 20 | execute: "install" # change to "uninstall" or pass `-e execute=uninstall` with the ansible-playbook command to uninstall 21 | clara_user: '' # add the name of the user on the machine 22 | # NVIDIA Driver Configuration: 23 | nvidia_driver_version: 460 24 | tasks: 25 | # Install NVIDIA Driver 26 | - name: Install Nvidia Driver (if needed) 27 | include_role: 28 | name: install-nvidia-driver 29 | when: execute=="install" 30 | 31 | - name: Remove Nvidia Driver 32 | include_role: 33 | name: remove-nvidia-driver 34 | when: execute=="uninstall" -------------------------------------------------------------------------------- /playbooks/roles/remove-nvidia-driver/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | # We install the /etc/profile.d/cuda-vars.sh script that will put 17 | # the CUDA toolkit binaries and libraries in the default environment 18 | cuda_toolkit_add_profile_script: yes 19 | 20 | 21 | # Ubuntu 22 | _ubuntu_repo_dir: "{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.', '') }}/{{ ansible_architecture }}" 23 | nvidia_driver_ubuntu_cuda_repo_gpgkey_url: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}/7fa2af80.pub" 24 | nvidia_driver_ubuntu_cuda_repo_gpgkey_id: "7fa2af80" 25 | nvidia_driver_ubuntu_cuda_repo_baseurl: "http://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}" -------------------------------------------------------------------------------- /playbooks/clara_hosts: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Define Clara Host Variables Here. Note, the contents of this file can be copied to `/etc/ansible/hosts` 16 | 17 | [clara_hosts] 18 | # ** To install Clara onto one or more remote machines, running Ansible from your local machine ** 19 | # add their IP addresses below, eg: 20 | # 10.0.0.2 21 | 22 | # ** To installing Clara on your local machine, running Ansible from your local machine ** 23 | # Copy the contents of your SSH public key (~/.ssh/id_rsa.pub) into ~/.ssh/authorized_keys 24 | # In addition, set the following IP address.: 25 | # 127.0.0.1 26 | 27 | [clara_hosts:vars] 28 | # Force Ansible to use Python3. Only change if your Python3 binary is in a different location 29 | ansible_python_interpreter=/usr/bin/python3 30 | -------------------------------------------------------------------------------- /playbooks/roles/remove-clara-components/tasks/remove-clara-components.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Stop Clara Components 17 | command: "clara {{ item }} stop -y" 18 | with_items: "{{ clara_components }}" 19 | become_user: '{{ clara_user }}' 20 | ignore_errors: true 21 | args: 22 | warn: false 23 | 24 | - name: "Prompt for removal of .clara directory" 25 | pause: 26 | prompt: "Remove .clara directory [y/N]" 27 | echo: yes 28 | register: rm_clara_dotfiles 29 | 30 | - set_fact: 31 | remove_clara_dotfiles: "{{ rm_clara_dotfiles.user_input }}" 32 | 33 | - name: Remove .clara directory 34 | become: yes 35 | file: 36 | path: "/home/{{ clara_user }}/.clara" 37 | state: absent 38 | async: 45 39 | poll: 5 40 | ignore_errors: yes 41 | when: rm_clara_dotfiles=='y' -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-driver/defaults/main.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | # 'cuda' is the generic package and will pull the latest version 17 | 18 | # Install the /etc/profile.d/cuda-vars.sh script that will put 19 | # the CUDA toolkit binaries and libraries in the default environmentL: 20 | cuda_toolkit_add_profile_script: yes 21 | 22 | # Ubuntu specific variables 23 | _ubuntu_repo_dir: "{{ ansible_distribution | lower }}{{ ansible_distribution_version | replace('.', '') }}/{{ ansible_architecture }}" 24 | nvidia_driver_ubuntu_cuda_repo_gpgkey_url: "https://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}/7fa2af80.pub" 25 | nvidia_driver_ubuntu_cuda_repo_gpgkey_id: "7fa2af80" 26 | nvidia_driver_ubuntu_cuda_repo_baseurl: "http://developer.download.nvidia.com/compute/cuda/repos/{{ _ubuntu_repo_dir }}" -------------------------------------------------------------------------------- /playbooks/roles/remove-nvidia-docker/tasks/remove-docker-ce.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: "Uninstall Docker" 17 | pause: 18 | prompt: "Remove Docker? [y/N]" 19 | echo: yes 20 | register: rm_docker 21 | - set_fact: 22 | remove_docker: "{{ rm_docker.user_input }}" 23 | 24 | - name: Remove Docker CE package on Bionic 25 | become: yes 26 | apt: 27 | name: docker-ce 28 | state: absent 29 | when: "ansible_lsb.release=='18.04'" 30 | 31 | - name: Remove Docker CE Repository on Bionic 32 | become: yes 33 | apt_repository: 34 | repo: "{{ docker_ce_repo }}" 35 | state: absent 36 | when: 37 | - remove_docker=='y' 38 | - "ansible_lsb.release=='18.04'" 39 | 40 | - name: Remove Docker.io package on Focal 41 | become: yes 42 | apt: 43 | name: docker.io 44 | state: absent 45 | when: 46 | - remove_docker=='y' 47 | - "ansible_lsb.release=='18.04'" -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-docker/tasks/install-nvidia-docker.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Add Repository Key 17 | become: yes 18 | apt_key: 19 | url: "{{ nvidia_docker_gpg }}" 20 | state: present 21 | 22 | - name: Add Repository Source 23 | become: yes 24 | get_url: 25 | url: "{{ nvidia_docker_repo_src }}" 26 | dest: "{{ nvidia_docker_repo_dst }}" 27 | owner: root 28 | group: root 29 | mode: 0644 30 | 31 | - name: Install Nvidia Docker 2 32 | become: yes 33 | apt: name=nvidia-docker2 state=latest update_cache=yes 34 | register: nvidia_docker_install 35 | 36 | - name: Update daemon.json with NVIDIA as Default Runtime 37 | become: yes 38 | copy: 39 | src: files/daemon.json 40 | dest: /etc/docker/daemon.json 41 | 42 | - name: Reload Docker Configuration 43 | become: yes 44 | service: name=docker state=reloaded 45 | when: nvidia_docker_install.changed == True -------------------------------------------------------------------------------- /playbooks/roles/remove-nvidia-docker/tasks/remove-nvidia-docker.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: "Uninstall NVIDIA Docker 2" 17 | pause: 18 | prompt: "Remove NVIDIA Docker 2? [y/N]" 19 | echo: yes 20 | register: rm_nvidia_docker 21 | - set_fact: 22 | remove_nvidia_docker: "{{ rm_nvidia_docker.user_input }}" 23 | - debug: 24 | var: remove_nvidia_docker 25 | 26 | - name: Remove Nvidia Docker Apt Repo 27 | become: yes 28 | file: 29 | path: /etc/apt/sources.list.d/nvidia-docker.list 30 | state: absent 31 | when: remove_nvidia_docker=='y' 32 | 33 | - name: Remove Nvidia Docker 2 34 | become: yes 35 | apt: 36 | name: nvidia-docker2 37 | state: absent 38 | purge: yes 39 | when: remove_nvidia_docker=='y' 40 | 41 | - name: Restart Docker after removing nvidia-docker2 42 | become: yes 43 | systemd: 44 | name: docker 45 | state: reloaded 46 | when: remove_nvidia_docker=='y' 47 | -------------------------------------------------------------------------------- /playbooks/roles/remove-nvidia-driver/tasks/remove-ubuntu-driver.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | 17 | - name: Remove NVIDIA driver ppa 18 | become: yes 19 | apt_repository: 20 | repo: ppa:graphics-drivers/ppa 21 | state: absent 22 | 23 | - name: Uninstall NVIDIA driver 24 | become: yes 25 | apt: 26 | name: 27 | - "nvidia-driver-*" 28 | - "libnvidia-compute-*" 29 | - "nvidia-utils-*" 30 | - nvidia-smi 31 | state: absent 32 | autoremove: yes 33 | 34 | - name: Remove Profile Script to Set Environment for Toolkit 35 | become: yes 36 | file: 37 | dest: "/etc/profile.d/cuda-vars.sh" 38 | state: "absent" 39 | 40 | when: cuda_toolkit_add_profile_script 41 | - name: "Reboot" 42 | become: yes 43 | pause: 44 | prompt: "Reboot now? (This will complete the removal of the NVIDIA driver) [y/N]" 45 | echo: yes 46 | register: restart 47 | 48 | - set_fact: 49 | reboot: "{{ restart.user_input }}" 50 | 51 | - name: Reboot Machine after removal 52 | become: yes 53 | run_once: true 54 | reboot: 55 | reboot_timeout: 360 56 | when: reboot=='y' 57 | -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-docker/tasks/install-docker-ce.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Add package ca-certificates before adding GPG keys 17 | become: yes 18 | apt: 19 | name: ca-certificates 20 | update_cache: yes 21 | state: present 22 | 23 | - name: Add apt package apt-transport-https before adding GPG keys 24 | become: yes 25 | apt: 26 | name: apt-transport-https 27 | update_cache: yes 28 | state: present 29 | 30 | - name: Add Docker CE GPG Apt Key (Ubuntu) 31 | become: yes 32 | when: "ansible_lsb.release=='18.04'" 33 | apt_key: 34 | url: "{{ docker_ce_gpg }}" 35 | state: present 36 | 37 | - name: Add Docker CE Repository (Bionic) 38 | become: yes 39 | when: ansible_lsb.release=='18.04' 40 | apt_repository: 41 | repo: "{{ docker_ce_repo_bionic }}" 42 | state: present 43 | 44 | - name: Update apt and Install Docker CE on Bionic 45 | become: yes 46 | apt: 47 | update_cache: yes 48 | name: docker.io 49 | state: latest 50 | install_recommends: yes 51 | when: "ansible_lsb.release=='18.04'" 52 | 53 | - name: Update apt and Install Docker.io on Focal 54 | become: yes 55 | apt: 56 | update_cache: yes 57 | name: docker.io 58 | state: latest 59 | install_recommends: yes 60 | when: "ansible_lsb.release=='20.04'" 61 | 62 | - name: Add the user to Docker group 63 | user: 64 | name: "{{ clara_user }}" 65 | groups: 66 | - docker 67 | append: yes -------------------------------------------------------------------------------- /playbooks/roles/install-kubernetes/files/kube-flannel-rbac.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2015 flannel authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Copyright 2021 NVIDIA Corporation 16 | 17 | # Licensed under the Apache License, Version 2.0 (the "License"); 18 | # you may not use this file except in compliance with the License. 19 | # You may obtain a copy of the License at 20 | 21 | # http://www.apache.org/licenses/LICENSE-2.0 22 | 23 | # Unless required by applicable law or agreed to in writing, software 24 | # distributed under the License is distributed on an "AS IS" BASIS, 25 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | # See the License for the specific language governing permissions and 27 | # limitations under the License. 28 | --- 29 | kind: ClusterRole 30 | apiVersion: rbac.authorization.k8s.io/v1beta1 31 | metadata: 32 | name: flannel 33 | rules: 34 | - apiGroups: 35 | - "" 36 | resources: 37 | - pods 38 | verbs: 39 | - get 40 | - apiGroups: 41 | - "" 42 | resources: 43 | - nodes 44 | verbs: 45 | - list 46 | - watch 47 | - apiGroups: 48 | - "" 49 | resources: 50 | - nodes/status 51 | verbs: 52 | - patch 53 | --- 54 | kind: ClusterRoleBinding 55 | apiVersion: rbac.authorization.k8s.io/v1beta1 56 | metadata: 57 | name: flannel 58 | roleRef: 59 | apiGroup: rbac.authorization.k8s.io 60 | kind: ClusterRole 61 | name: flannel 62 | subjects: 63 | - kind: ServiceAccount 64 | name: flannel 65 | namespace: kube-system 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![NVIDIA](./.github/logo.jpg)](https://docs.nvidia.com/clara/deploy/index.html) 3 | 4 | 5 | ## Clara Platform Ansible Playbooks 6 | This repository contains Ansible playbooks to install Clara Deploy Platform. 7 | 8 | 9 | ## Additional Resources to Learn More on Clara Deploy 10 | 11 | * [NVIDIA Clara Overview Homepage](https://developer.nvidia.com/clara) 12 | * [NVIDIA Clara Deploy SDK User Guide](https://docs.nvidia.com/clara/deploy/index.html) 13 | 14 | 15 | ### Supported Ansible versions 16 | 17 | Clara supports using Ansible 2.9.x. 18 | Ansible 2.10.x and newer are not currently supported. 19 | 20 | ### Supported distributions 21 | 22 | Clara currently supports the following Linux distributions: 23 | 24 | * NVIDIA DGX OS 4, 5 25 | * Ubuntu 18.04 LTS, 20.04 LTS 26 | 27 | ## Getting Started 28 | 29 | For detailed help or guidance, read through our [Getting Started Guide](ngc/overview.md) or pick one of the deployment options documented below. 30 | 31 | ## Installation Components 32 | The Clara Ansible Playbooks will install the following components either on a remote, or a local system: 33 | - Docker CE 34 | - NVIDIA Docker 2 35 | - Additional Python libraries to enable the k8s Ansible module 36 | - Kubernetes (kubeadm, kubectl, kubelet) 37 | - Helm v2 38 | - NGC CLI (note: you will need an API key from [NGC](https://ngc.nvidia.com)) 39 | - Clara CLI 40 | - Clara Helm Chart 41 | 42 | ### Kubernetes 43 | 44 | Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications. 45 | 46 | For more information on Kubernetes in general, refer to the [official Kubernetes docs](https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/). 47 | 48 | 49 | ## Contributing 50 | 51 | To contribute, please issue a [signed](https://gitlab-master.nvidia.com/Clara/clara-ansible/-/blob/master/CONTRIBUtING.md#legalese) [pull request](https://help.github.com/articles/using-pull-requests/) against the master branch from a local fork. See the [contribution document](https://gitlab-master.nvidia.com/Clara/clara-ansible/-/blob/master/CONTRIBUtING.md#legalese) for more information. -------------------------------------------------------------------------------- /playbooks/roles/install-clara-cli/tasks/install-ngc-cli.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Ensure Unzip is present 17 | become: yes 18 | apt: 19 | update_cache: yes 20 | name: unzip 21 | state: latest 22 | 23 | - name: Download NGC CLI 24 | get_url: 25 | url: "{{ ngc_cli_url }}" 26 | dest: "{{ ngc_cli_dest }}" 27 | 28 | - name: Create NGC Unarchive Location 29 | file: 30 | path: "{{ ngc_tmp_unpack }}" 31 | state: directory 32 | 33 | - name: Unarchive NGC CLI 34 | unarchive: 35 | src: "{{ ngc_cli_dest }}" 36 | dest: "{{ ngc_tmp_unpack }}" 37 | remote_src: yes 38 | 39 | - name: Verify NGC CLI Checksum 40 | command: md5sum -c ngc.md5 41 | args: 42 | chdir: "{{ ngc_tmp_unpack }}" 43 | register: md5match 44 | failed_when: "'FAILED' in md5match.stdout" 45 | 46 | - name: Make NGC CLI Executable 47 | file: 48 | path: "{{ ngc_tmp_unpack }}/ngc" 49 | mode: a+x 50 | 51 | - name: Copy the NGC CLI to Path 52 | copy: 53 | src: "{{ ngc_tmp_unpack }}/ngc" 54 | dest: "{{ ngc_bin_path }}/ngc" 55 | remote_src: yes 56 | owner: root 57 | group: root 58 | mode: '0755' 59 | become: yes 60 | 61 | - name: Create NGC config directory in the user home dir 62 | file: 63 | path: "/home/{{ clara_user }}/.ngc" 64 | state: directory 65 | mode: '0755' 66 | become_user: '{{ clara_user }}' 67 | 68 | - name: Configure NGC CLI 69 | template: 70 | src: ngc_config.j2 71 | dest: "/home/{{ clara_user }}/.ngc/config" 72 | mode: '0600' 73 | become_user: '{{ clara_user }}' -------------------------------------------------------------------------------- /playbooks/roles/install-clara-cli/tasks/install-clara-cli.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Remove Any Existing Clara CLI Packages 17 | shell: rm -rf clara_cli* 18 | args: 19 | chdir: /tmp 20 | 21 | - name: Download Latest Clara CLI 22 | command: ngc registry resource download-version {{ngc_org}}/{{ngc_team}}/{{cli_target}} 23 | args: 24 | chdir: /tmp 25 | become_user: '{{ clara_user }}' 26 | 27 | 28 | - name: Unarchive Clara CLI Package 29 | shell: find clara_cli* | grep cli.zip | xargs -I {} unzip {} -d clara_cli 30 | args: 31 | chdir: /tmp 32 | 33 | - name: Find Clara CLI Binaries 34 | find: 35 | paths: [ "/tmp/clara_cli" ] 36 | patterns: 'clara*' 37 | file_type: file 38 | register: clara_cli_binaries 39 | 40 | - name: Copy Clara CLI Binaries to Path 41 | copy: 42 | src: '{{item.path}}' 43 | dest: /usr/local/bin/ 44 | remote_src: yes 45 | owner: root 46 | group: root 47 | mode: '0755' 48 | with_items: '{{clara_cli_binaries.files}}' 49 | become: yes 50 | 51 | - name: Confirm Clara CLI is Installed Present 52 | command: which clara 53 | register: command_result 54 | failed_when: "'FAILED' in command_result.stderr" 55 | 56 | - name: Configure Clara CLI with NGC Credentials and Org/Team 57 | command: "clara config -y --key {{ ngc_api_key }} --orgteam '{{ ngc_org }}/{{ ngc_team }}' --verbose" 58 | become: false 59 | become_user: '{{ clara_user }}' 60 | 61 | - name: Check Clara CLI Configuration 62 | stat: 63 | path: "/home/{{ clara_user }}/.clara" 64 | register: stat_result 65 | failed_when: not stat_result.stat.exists 66 | -------------------------------------------------------------------------------- /playbooks/roles/install-nvidia-driver/tasks/install-ubuntu-driver.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | 16 | - name: Remove Cuda ppa before installing CUDA (if applicable) 17 | become: yes 18 | apt_repository: 19 | repo: ppa:graphics-drivers/ppa 20 | state: absent 21 | 22 | - name: Add Cuda-ubuntu pin file 23 | become: yes 24 | copy: 25 | src: "cuda-ubuntu.pin" 26 | dest: "/etc/apt/preferences.d/cuda-repository-pin-600" 27 | owner: "root" 28 | group: "root" 29 | mode: "0644" 30 | 31 | - name: Add Cuda apt key 32 | become: yes 33 | apt_key: 34 | url: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_url }}" 35 | id: "{{ nvidia_driver_ubuntu_cuda_repo_gpgkey_id }}" 36 | environment: "{{proxy_env if proxy_env is defined else {}}}" 37 | 38 | - name: Add CUDA Apt repository 39 | become: yes 40 | apt_repository: 41 | repo: "deb {{ nvidia_driver_ubuntu_cuda_repo_baseurl }} /" 42 | update_cache: yes 43 | environment: "{{proxy_env if proxy_env is defined else {}}}" 44 | 45 | - name: Install NVIDIA Driver 46 | become: yes 47 | apt: 48 | name: "nvidia-driver-{{ nvidia_driver_version }}" 49 | state: present 50 | register: driver_installed 51 | 52 | - name: Add Profile Script to Set Environment for Toolkit 53 | copy: 54 | src: "cuda-vars.sh" 55 | dest: "/etc/profile.d/cuda-vars.sh" 56 | owner: "root" 57 | group: "root" 58 | mode: "0644" 59 | when: cuda_toolkit_add_profile_script 60 | 61 | - name: Reboot system (if applicable) 62 | pause: 63 | prompt: "Reboot system now (to complete NVIDIA Driver installation)? [y/N]" 64 | echo: yes 65 | register: reboot 66 | ignore_errors: true 67 | 68 | - name: Reboot Machine after install 69 | reboot: 70 | reboot_timeout: 360 71 | become: yes 72 | ignore_errors: true 73 | when: 74 | - reboot.user_input=='y' -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute to NVIDIA Clara Platform Ansible Playbooks 2 | 3 | All PRs submitted to the Clara Platform Ansible project must be signed, see below for more information 4 | 5 | 6 | ## Sign your work 7 | 8 | The sign-off is a simple line at the end of the explanation for the patch. Your 9 | signature certifies that you wrote the patch or otherwise have the right to pass 10 | it on as an open-source patch. The rules are pretty simple: if you can certify 11 | the below (from [developercertificate.org](http://developercertificate.org/)): 12 | 13 | ``` 14 | Developer Certificate of Origin 15 | Version 1.1 16 | 17 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 18 | 1 Letterman Drive 19 | Suite D4700 20 | San Francisco, CA, 94129 21 | 22 | Everyone is permitted to copy and distribute verbatim copies of this 23 | license document, but changing it is not allowed. 24 | 25 | Developer's Certificate of Origin 1.1 26 | 27 | By making a contribution to this project, I certify that: 28 | 29 | (a) The contribution was created in whole or in part by me and I 30 | have the right to submit it under the open source license 31 | indicated in the file; or 32 | 33 | (b) The contribution is based upon previous work that, to the best 34 | of my knowledge, is covered under an appropriate open source 35 | license and I have the right under that license to submit that 36 | work with modifications, whether created in whole or in part 37 | by me, under the same open source license (unless I am 38 | permitted to submit under a different license), as indicated 39 | in the file; or 40 | 41 | (c) The contribution was provided directly to me by some other 42 | person who certified (a), (b) or (c) and I have not modified 43 | it. 44 | 45 | (d) I understand and agree that this project and the contribution 46 | are public and that a record of the contribution (including all 47 | personal information I submit with it, including my sign-off) is 48 | maintained indefinitely and may be redistributed consistent with 49 | this project or the open source license(s) involved. 50 | ``` 51 | 52 | Then you just add a line to every git commit message: 53 | 54 | Signed-off-by: Joe Smith 55 | 56 | Use your real name (sorry, no pseudonyms or anonymous contributions.) 57 | 58 | If you set your `user.name` and `user.email` git configs, you can sign your 59 | commit automatically with `git commit -s`. 60 | -------------------------------------------------------------------------------- /playbooks/roles/remove-clara-cli/tasks/remove-clara-cli.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: Check for 'clara' binary 17 | shell: "which clara" 18 | register: clara 19 | ignore_errors: True 20 | 21 | - name: Remove 'clara' binary 22 | become: yes 23 | file: 24 | path: "{{ clara.stdout }}" 25 | state: absent 26 | when: clara.stdout != '' 27 | 28 | - name: Check for 'clarac' binary 29 | shell: "which clarac" 30 | register: clarac 31 | ignore_errors: True 32 | 33 | - name: Remove 'clarac' binary 34 | become: yes 35 | file: 36 | path: "{{ clarac.stdout }}" 37 | state: absent 38 | when: clarac.stdout != '' 39 | 40 | - name: Check for 'clara-console' binary 41 | shell: "which clara-console" 42 | register: clara_console 43 | ignore_errors: True 44 | 45 | - name: Remove 'clara-console' binary 46 | become: yes 47 | file: 48 | path: "{{ clara_console.stdout }}" 49 | state: absent 50 | when: clara_console.stdout != '' 51 | 52 | - name: Check for 'clara-dicom' binary 53 | shell: "which clara-dicom" 54 | register: clara_dicom 55 | ignore_errors: True 56 | 57 | - name: Remove 'clara-dicom' binary 58 | become: yes 59 | file: 60 | path: "{{ clara_dicom.stdout }}" 61 | state: absent 62 | when: clara_dicom.stdout != '' 63 | 64 | - name: Check for 'clara-pull' binary 65 | shell: "which clara-pull" 66 | register: clara_pull 67 | ignore_errors: True 68 | 69 | - name: Remove 'clara-pull' binary 70 | become: yes 71 | file: 72 | path: "{{ clara_pull.stdout }}" 73 | state: absent 74 | when: clara_pull.stdout != '' 75 | 76 | - name: Check for 'clara-platform' binary 77 | shell: "which clara-platform" 78 | register: clara_platform 79 | ignore_errors: True 80 | 81 | - name: Remove 'clara-platform' binary 82 | become: yes 83 | file: 84 | path: "{{ clara_platform.stdout }}" 85 | state: absent 86 | when: clara_platform.stdout != '' 87 | 88 | - name: Check for 'clara-render' binary 89 | shell: "which clara-render" 90 | register: clara_render 91 | ignore_errors: True 92 | 93 | - name: Remove 'clara-render' binary 94 | become: yes 95 | file: 96 | path: "{{ clara_render.stdout }}" 97 | state: absent 98 | when: clara_render.stdout != '' -------------------------------------------------------------------------------- /playbooks/clara.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - hosts: all 16 | gather_facts: yes 17 | remote_user: "{{ clara_user }}" 18 | become: yes 19 | vars: 20 | execute: "install" # change to "uninstall" or pass `-e execute=uninstall` with the ansible-playbook command to uninstall 21 | clara_user: '' # add the name of the user on the machine 22 | 23 | # Set this before running the install-clara playbook 24 | ngc_api_key: '' 25 | # NGC (NVIDIA Graphics Cloud) Org and Team to Install Clara from: 26 | ngc_org: nvidia 27 | ngc_team: clara 28 | ngc_helm_repo: https://helm.ngc.nvidia.com 29 | 30 | # Install base Clara Component(s) -- 'platform' is always necesary for Clara to run 31 | clara_components: [ 'platform', 'dicom'] 32 | # Example value with all availalbe components: 33 | # clara_components: [ 'platform', 'dicom', 'render', 'console' ] 34 | 35 | # Note that the Kubernetes pod_network_cidr variable is network specific. 36 | # It is configurable by changing the variable below if needed. 37 | # More information here https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#pod-network 38 | pod_network_cidr: 10.254.0.0/16 39 | tasks: 40 | # Install Clara 41 | - name: Install Nvidia Docker 42 | include_role: 43 | name: install-nvidia-docker 44 | when: execute=="install" 45 | - name: Install Kubernetes Configured for Clara 46 | include_role: 47 | name: install-kubernetes 48 | when: execute=="install" 49 | - name: Install Clara CLI 50 | include_role: 51 | name: install-clara-cli 52 | when: execute=="install" 53 | - name: Install Clara Components 54 | include_role: 55 | name: install-clara-components 56 | when: execute=="install" 57 | # Uninstall Clara 58 | - name: Uninstall Clara Components 59 | include_role: 60 | name: remove-clara-components 61 | when: execute=="uninstall" 62 | - name: Uninstall Clara CLI 63 | include_role: 64 | name: remove-clara-cli 65 | when: execute=="uninstall" 66 | - name: Uninstall Kubernetes Configured for Clara 67 | include_role: 68 | name: remove-kubernetes 69 | when: execute=="uninstall" 70 | - name: Uninstall Nvidia Docker 71 | include_role: 72 | name: remove-nvidia-docker 73 | when: execute=="uninstall" 74 | -------------------------------------------------------------------------------- /playbooks/roles/remove-kubernetes/tasks/remove-kubernetes.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | - name: "Prompt for removal" 17 | pause: 18 | prompt: "Remove Kubernetes (run kubeadm reset)? [y/N]" 19 | echo: yes 20 | register: rmk8s 21 | - set_fact: 22 | removek8s: "{{ rmk8s.user_input }}" 23 | - debug: 24 | var: removek8s 25 | 26 | - name: Run kubeadm reset 27 | become: yes 28 | shell: echo y | kubeadm reset -f 29 | when: removek8s=='y' 30 | ignore_errors: yes 31 | 32 | - name: Remove Kubernetes Repository 33 | become: yes 34 | apt_repository: 35 | repo: "{{ kubernetes_repo }}" 36 | state: absent 37 | 38 | - name: Remove Kubernetes Files from Remote Host 39 | file: 40 | path: "tmp/{{item}}" 41 | state: absent 42 | with_items: 43 | - kube-flannel-rbac.yml 44 | - nvidia-device-plugin.yml 45 | - rbac-config.yml 46 | - kube-flannel.yml 47 | 48 | - name: "Uninstall kubernetes binaries" 49 | pause: 50 | prompt: "Uninstall Kubelet, Kubeadm & Kubectl? [y/N]" 51 | echo: yes 52 | register: rmkube 53 | - set_fact: 54 | removek8s: "{{ rmkube.user_input }}" 55 | - debug: 56 | var: removek8s 57 | 58 | - name: Remove APT hold on kubelet # This only removes apt-hold, does not remove the package 59 | become: yes 60 | dpkg_selections: 61 | name: kubelet 62 | selection: purge 63 | ignore_errors: True 64 | 65 | - name: Remove APT hold on kubeadm # This only removes apt-hold, does not remove the package 66 | become: yes 67 | dpkg_selections: 68 | name: kubeadm 69 | selection: purge 70 | ignore_errors: True 71 | 72 | - name: Remove APT hold on kubectl # This only removes apt-hold, does not remove the package 73 | become: yes 74 | dpkg_selections: 75 | name: kubectl 76 | selection: purge 77 | ignore_errors: True 78 | 79 | - name: Remove kubelet, kubeadm & kubectl 80 | become: yes 81 | apt: 82 | name: 83 | - kubelet 84 | - kubeadm 85 | - kubectl 86 | state: absent 87 | when: removek8s=='y' 88 | 89 | - name: "Prompt to remove .kube directory" 90 | pause: 91 | prompt: "Remove .kube Directory? [y/N]" 92 | echo: yes 93 | register: rmkubeconfigdir 94 | - set_fact: 95 | removekubeconfig: "{{ rmkubeconfigdir.user_input }}" 96 | - debug: 97 | var: removekubeconfig 98 | 99 | - name: Remove kube Directory 100 | file: 101 | path: "/home/{{ clara_user }}/.kube" 102 | state: absent 103 | when: removekubeconfig=='y' 104 | become: yes 105 | 106 | - name: "Prompt to uninstall helm" 107 | pause: 108 | prompt: "Remove Helm? [y/N]" 109 | echo: yes 110 | register: rmhelm 111 | - set_fact: 112 | removehelm: "{{ rmhelm.user_input }}" 113 | - debug: 114 | var: removehelm 115 | 116 | - name: Remove Nvidia NGC Helm Repository 117 | ignore_errors: yes 118 | shell: helm repo remove ngc 119 | become_user: '{{ clara_user }}' 120 | when: removehelm=='y' 121 | 122 | - name: Remove Helm 123 | become: yes 124 | file: 125 | path: "/usr/local/bin/helm" 126 | state: absent 127 | when: removehelm=='y' 128 | 129 | - name: Remove logrotate config for container logs 130 | file: 131 | path: "/etc/logrotate.d/container_logs" 132 | state: absent 133 | -------------------------------------------------------------------------------- /playbooks/roles/install-kubernetes/tasks/install-kubernetes.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 NVIDIA Corporation 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | - name: Add K8s GPG apt Key 16 | become: yes 17 | apt_key: 18 | url: "{{ kubernetes_gpg_key }}" 19 | state: present 20 | 21 | - name: Add Kubernetes Repository 22 | become: yes 23 | apt_repository: 24 | repo: "{{ kubernetes_repo }}" 25 | state: present 26 | 27 | - name: Update apt and Install kubelet 28 | become: yes 29 | apt: 30 | name: kubelet={{ kubernetes_version }} 31 | update_cache: yes 32 | state: present 33 | force: true 34 | register: kubelet_install 35 | 36 | - name: Hold kubelet at current version 37 | dpkg_selections: 38 | name: kubelet 39 | selection: hold 40 | 41 | - name: Update apt and Install kubeadm 42 | become: yes 43 | apt: 44 | name: kubeadm={{ kubernetes_version }} 45 | update_cache: yes 46 | force: true 47 | state: present 48 | 49 | - name: Hold kubeadm at current version 50 | dpkg_selections: 51 | name: kubeadm 52 | selection: hold 53 | 54 | - name: Update apt and Install kubectl 55 | become: yes 56 | apt: 57 | name: kubectl={{ kubernetes_version }} 58 | update_cache: yes 59 | force: true 60 | state: present 61 | 62 | - name: Hold kubectl at current version 63 | dpkg_selections: 64 | name: kubectl 65 | selection: hold 66 | 67 | - name: Copy Kubernetes Files to Remote Host 68 | copy: 69 | src: "files/{{item}}" 70 | dest: /tmp 71 | with_items: 72 | - kube-flannel-rbac.yml 73 | 74 | - name: Add kube-flannel template 75 | template: 76 | src: kube-flannel.j2 77 | dest: /tmp/kube-flannel.yml 78 | 79 | - name: Check if Kubernetes is initialized 80 | stat: 81 | path: /etc/kubernetes/admin.conf 82 | register: kubernetes_init 83 | 84 | - name: Check if Kubernetes has been initiated 85 | debug: 86 | msg: "Kube admin exists" 87 | when: kubernetes_init.stat.exists 88 | 89 | - name: Initialize kubeadm 90 | become: yes 91 | shell: kubeadm init --pod-network-cidr="{{ pod_network_cidr }}" --apiserver-cert-extra-sans="{{ ansible_default_ipv4.address }}" --log-file=/tmp/kubernetes_init.log 92 | when: not kubernetes_init.stat.exists 93 | 94 | - name: Creates User kube Directory 95 | file: 96 | path: "/home/{{ clara_user }}/.kube" 97 | state: directory 98 | 99 | - name: Copy Kubernetes Configuration 100 | become: yes 101 | copy: 102 | src: /etc/kubernetes/admin.conf 103 | dest: "/home/{{ clara_user }}/.kube/config" 104 | owner: "{{ clara_user }}" 105 | group: '{{ ansible_facts["real_group_id"] }}' 106 | mode: 0600 107 | remote_src: yes 108 | 109 | - name: Remove NoSchedule taint value on Primary Node 110 | shell: "kubectl taint node {{ ansible_hostname }} node-role.kubernetes.io/master:NoSchedule-" 111 | environment: 112 | KUBECONFIG: /home/{{ clara_user }}/.kube/config 113 | ignore_errors: true 114 | failed_when: false 115 | 116 | - name: Pause for 5 seconds before adding deployments 117 | pause: 118 | seconds: 5 119 | 120 | - name: Apply Flannel RBAC 121 | shell: | 122 | kubectl apply -f /tmp/kube-flannel-rbac.yml 123 | environment: 124 | KUBECONFIG: /home/{{ clara_user }}/.kube/config 125 | 126 | - name: Apply Flannel 127 | shell: | 128 | kubectl apply -f /tmp/kube-flannel.yml 129 | environment: 130 | KUBECONFIG: /home/{{ clara_user }}/.kube/config 131 | 132 | - name: Restart Kubelet 133 | become: yes 134 | service: 135 | name: kubelet 136 | daemon_reload: yes 137 | state: restarted 138 | when: kubelet_install.changed == True 139 | 140 | - name: Download Helm 141 | get_url: 142 | url: "https://get.helm.sh/{{ helm_filename }}" 143 | dest: "/tmp/{{ helm_filename }}" 144 | checksum: "{{ helm_checksum }}" 145 | 146 | - name: Install Helm Executable 147 | unarchive: 148 | src: "/tmp/{{ helm_filename }}" 149 | dest: /tmp 150 | remote_src: yes 151 | 152 | - name: Copy Helm Executable to Path 153 | become: yes 154 | copy: 155 | src: /tmp/linux-amd64/helm 156 | dest: /usr/local/bin 157 | remote_src: yes 158 | owner: "{{ clara_user }}" 159 | group: "{{ clara_user }}" 160 | mode: 0755 161 | 162 | - name: Add Nvidia Device Plug-in Repository to Helm 163 | shell: helm repo add nvdp https://nvidia.github.io/k8s-device-plugin 164 | become_user: '{{ clara_user }}' 165 | 166 | - name: Add Nvidia NGC Helm Repository 167 | shell: helm repo add ngc {{ ngc_helm_repo }}/{{ ngc_org }}/{{ ngc_team }} --username \$oauthtoken --password {{ ngc_api_key }} 168 | become_user: '{{ clara_user }}' 169 | 170 | - name: Update Helm Repository 171 | shell: helm repo update 172 | become_user: '{{ clara_user }}' 173 | 174 | - name: Install Nvidia Device Plugin 175 | shell: helm install --version={{ nvidia_device_plugin_version }} nvidia-device-plugin nvdp/nvidia-device-plugin 176 | become_user: '{{ clara_user }}' 177 | 178 | - name: Ensure logrotate directory exist 179 | become: yes 180 | file: 181 | path: /etc/logrotate.d 182 | state: directory 183 | mode: 0644 184 | 185 | - name: Copy logrotate config for container logs 186 | become: yes 187 | copy: 188 | group: "{{ clara_user }}" 189 | src: "files/container_logs" 190 | dest: /etc/logrotate.d/container_logs 191 | mode: 0755 192 | -------------------------------------------------------------------------------- /ngc/overview.md: -------------------------------------------------------------------------------- 1 | ## Clara Ansible Installation Scripts 2 | 3 | ### 1. Install Ansible 4 | 5 | To install Ansible follow the link [Installing Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html). 6 | 7 | **Note:** This playbook requires Ansible 2.9 or higher, which can be installed via system package manager such as apt or via Python's package manager pip. 8 | 9 | ### 2. Installing Clara 10 | 11 | #### 2.1 A note on the NVIDIA Driver 12 | It is assumed the host system has a working NVIDIA driver prior to installing Clara. If your host does not have the NVIDIA driver, you can install the correct version for this version of clara via the `playbooks/driver.yml` file. To install the driver using Ansible, see section 2.2 13 | 14 | 15 | #### 2.2 NVIDIA Driver installation via Ansible 16 | 17 | The recommended version of the NVIDIA driver for this version of Clara is specified in the `playbooks/driver.yml`. If you already have this driver, skip this step and continue to the Clara installation section below. 18 | 19 | **Note:** It is recommended to only install the NVIDIA driver via Ansible if you do not already have an NVIDIA driver present. Once the driver is instaled or uninstalled using Ansible you will be prompted to reboot the machine. If you are installing Clara locally, Ansible will not force a reboot and you will need to run the reboot command manually. It is required to reboot the system after installation to ensure successful installation of Clara. 20 | 21 | Before running the driver installation playbook, edit the `playbooks/driver.yml` file and ensure the name of the system user that Ansible should login as is set. 22 | 23 | To install the driver locally, run: 24 | ``` 25 | ansible-playbook -K driver.yml 26 | ``` 27 | 28 | To install the driver on remote hosts, change the value of `hosts` to `all` in `/playbooks/clara.yml`, set the IP address(es) of the remote machine(s) in `/playbooks/clara_hosts` then run the following command: 29 | ``` 30 | ansible-playbook -K driver.yml -i clara_hosts 31 | ``` 32 | 33 | #### 2.3 Uninstalling NVIDIA Driver via ansible 34 | 35 | **Note:** Due to multiple driver installation methods, do not attempt to run the driver uninstall playbook if the driver was not instaled by Ansible. 36 | 37 | Before running the driver installation playbook, edit the `playbooks/driver.yml` file and ensure the name of the system user that Ansible should login as is set. 38 | 39 | To uninstall the driver locally, run: 40 | ``` 41 | ansible-playbook -K driver.yml -e 'execute=uninstall' 42 | ``` 43 | 44 | To uninstall the driver on remote hosts, change the value of `hosts` to `all` in `/playbooks/clara.yml`, set the IP address(es) of the remote machine(s) in `/playbooks/clara_hosts` then run the following command: 45 | ``` 46 | ansible-playbook -K driver.yml -e 'execute=uninstall' -i clara_hosts 47 | ``` 48 | 49 | 50 | #### 2.3 Installing Clara locally 51 | 52 | To run the playbooks locally (on the same system with Ansible), first, edit `playbooks/clara.yml` and set the following values: 53 | 54 | - `clara_user` - Set this to the non-root user of the machine 55 | - `ngc_api_key` - If you do not already have an NGC account/key see [this page](https://docs.nvidia.com/ngc/ngc-overview/index.html#registering-activating-ngc-account) to get started 56 | 57 | Once the values are set, `cd` into the `/playbooks` directory and run: 58 | `ansible-playbook -K clara.yml` 59 | 60 | **Note:** Editable values can be configured in the `clara.yml` file (eg. `ngc_org: ea-nvidia-clara` for early access users, additional Clara components, Kubernetes networking settings) 61 | 62 | #### 2.3 Installing Clara on remote hosts 63 | 64 | ##### 2.3.1 Setting SSH Connectivity 65 | 66 | Ansible works on remote machines over SSH connection. To install Clara onto remote machines, create a local SSH key and make sure it is copied to all remote hosts in which you aim to install Clara on. 67 | 68 | For example, you can generate a key locally, then copy it to the remote target host using the folowing two commands: 69 | ``` 70 | # ssh-keygen 71 | # ssh-copy-id -i ~/.ssh/mykey user@targethost 72 | ``` 73 | 74 | #### 2.3.2 Run install playbook 75 | To run the playbooks onto one or more remote hosts from your local machine, first, add the IP address(es) of the remote machine(s) in the file `playbooks/clara_hosts`. Then edit `playbooks/clara.yml` and set the following values: 76 | 77 | - `hosts` - Set this to `all` 78 | - `clara_user` - Set this to the non-root user of the machine 79 | - `ngc_api_key` - If you do not already have an NGC account/key see [this page](https://docs.nvidia.com/ngc/ngc-overview/index.html#registering-activating-ngc-account) to get started 80 | 81 | Once the values are set, `cd` into the `/playbooks` directory and run: 82 | `ansible-playbook -K clara.yml` 83 | 84 | **Note:** Editable values can be configured in the `clara.yml` file (eg. `ngc_org: ea-nvidia-clara` for early access users, additional Clara components, Kubernetes networking settings) 85 | 86 | ### 3 Uninstalling Clara 87 | 88 | To uninstall Clara locally, run: 89 | ``` 90 | ansible-playbook -K clara.yml -e 'execute=uninstall' 91 | ``` 92 | 93 | To uninstall Clara on remote hosts, run: 94 | ``` 95 | ansible-playbook -K clara.yml -e 'execute=uninstall' -i clara_hosts 96 | ``` 97 | 98 | This will prompt to remove: 99 | - `.clara` data directory 100 | - Helm 101 | - Kubernetes & Kubernetes Binaries 102 | - NVIDIA Docker 103 | - Docker 104 | 105 | #### Tasks 106 | 107 | The Clara Ansible playbook will: 108 | * Install NVIDIA Driver (optional) 109 | * Install Docker CE 110 | * Install NVIDIA Docker 2 (optional) 111 | * Turn Swap space off 112 | * Install OpenShift Python libraries to enable the `k8s` Ansible module 113 | * Install and Kubernetes 114 | * Install Helm3 115 | * Install Clara CLI Binaries and Components 116 | * Pull Clara Components from [NGC](https://docs.nvidia.com/ngc/ngc-overview/index.html) (requires NGC API key) 117 | * Start Clara 118 | 119 | #### Assumptions 120 | 121 | * The playbook is designed for Ubuntu on the `x86_64` architecture, however, the user may update or enhance the playbooks to fit their target systems. -------------------------------------------------------------------------------- /playbooks/roles/install-kubernetes/templates/kube-flannel.j2: -------------------------------------------------------------------------------- 1 | # Copyright 2015 flannel authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Copyright 2021 NVIDIA Corporation 16 | 17 | # Licensed under the Apache License, Version 2.0 (the "License"); 18 | # you may not use this file except in compliance with the License. 19 | # You may obtain a copy of the License at 20 | 21 | # http://www.apache.org/licenses/LICENSE-2.0 22 | 23 | # Unless required by applicable law or agreed to in writing, software 24 | # distributed under the License is distributed on an "AS IS" BASIS, 25 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 26 | # See the License for the specific language governing permissions and 27 | # limitations under the License. 28 | --- 29 | apiVersion: policy/v1beta1 30 | kind: PodSecurityPolicy 31 | metadata: 32 | name: psp.flannel.unprivileged 33 | annotations: 34 | seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default 35 | seccomp.security.alpha.kubernetes.io/defaultProfileName: docker/default 36 | apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default 37 | apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default 38 | spec: 39 | privileged: false 40 | volumes: 41 | - configMap 42 | - secret 43 | - emptyDir 44 | - hostPath 45 | allowedHostPaths: 46 | - pathPrefix: "/etc/cni/net.d" 47 | - pathPrefix: "/etc/kube-flannel" 48 | - pathPrefix: "/run/flannel" 49 | readOnlyRootFilesystem: false 50 | # Users and groups 51 | runAsUser: 52 | rule: RunAsAny 53 | supplementalGroups: 54 | rule: RunAsAny 55 | fsGroup: 56 | rule: RunAsAny 57 | # Privilege Escalation 58 | allowPrivilegeEscalation: false 59 | defaultAllowPrivilegeEscalation: false 60 | # Capabilities 61 | allowedCapabilities: ['NET_ADMIN', 'NET_RAW'] 62 | defaultAddCapabilities: [] 63 | requiredDropCapabilities: [] 64 | # Host namespaces 65 | hostPID: false 66 | hostIPC: false 67 | hostNetwork: true 68 | hostPorts: 69 | - min: 0 70 | max: 65535 71 | # SELinux 72 | seLinux: 73 | # SELinux is unused in CaaSP 74 | rule: 'RunAsAny' 75 | --- 76 | kind: ClusterRole 77 | apiVersion: rbac.authorization.k8s.io/v1 78 | metadata: 79 | name: flannel 80 | rules: 81 | - apiGroups: ['extensions'] 82 | resources: ['podsecuritypolicies'] 83 | verbs: ['use'] 84 | resourceNames: ['psp.flannel.unprivileged'] 85 | - apiGroups: 86 | - "" 87 | resources: 88 | - pods 89 | verbs: 90 | - get 91 | - apiGroups: 92 | - "" 93 | resources: 94 | - nodes 95 | verbs: 96 | - list 97 | - watch 98 | - apiGroups: 99 | - "" 100 | resources: 101 | - nodes/status 102 | verbs: 103 | - patch 104 | --- 105 | kind: ClusterRoleBinding 106 | apiVersion: rbac.authorization.k8s.io/v1 107 | metadata: 108 | name: flannel 109 | roleRef: 110 | apiGroup: rbac.authorization.k8s.io 111 | kind: ClusterRole 112 | name: flannel 113 | subjects: 114 | - kind: ServiceAccount 115 | name: flannel 116 | namespace: kube-system 117 | --- 118 | apiVersion: v1 119 | kind: ServiceAccount 120 | metadata: 121 | name: flannel 122 | namespace: kube-system 123 | --- 124 | kind: ConfigMap 125 | apiVersion: v1 126 | metadata: 127 | name: kube-flannel-cfg 128 | namespace: kube-system 129 | labels: 130 | tier: node 131 | app: flannel 132 | data: 133 | cni-conf.json: | 134 | { 135 | "name": "cbr0", 136 | "cniVersion": "0.3.1", 137 | "plugins": [ 138 | { 139 | "type": "flannel", 140 | "delegate": { 141 | "hairpinMode": true, 142 | "isDefaultGateway": true 143 | } 144 | }, 145 | { 146 | "type": "portmap", 147 | "capabilities": { 148 | "portMappings": true 149 | } 150 | } 151 | ] 152 | } 153 | net-conf.json: | 154 | { 155 | "Network": "{{ pod_network_cidr }}", 156 | "Backend": { 157 | "Type": "vxlan" 158 | } 159 | } 160 | --- 161 | apiVersion: apps/v1 162 | kind: DaemonSet 163 | metadata: 164 | name: kube-flannel-ds 165 | namespace: kube-system 166 | labels: 167 | tier: node 168 | app: flannel 169 | spec: 170 | selector: 171 | matchLabels: 172 | app: flannel 173 | template: 174 | metadata: 175 | labels: 176 | tier: node 177 | app: flannel 178 | spec: 179 | affinity: 180 | nodeAffinity: 181 | requiredDuringSchedulingIgnoredDuringExecution: 182 | nodeSelectorTerms: 183 | - matchExpressions: 184 | - key: kubernetes.io/os 185 | operator: In 186 | values: 187 | - linux 188 | hostNetwork: true 189 | priorityClassName: system-node-critical 190 | tolerations: 191 | - operator: Exists 192 | effect: NoSchedule 193 | serviceAccountName: flannel 194 | initContainers: 195 | - name: install-cni 196 | image: quay.io/coreos/flannel:v0.13.0 197 | command: 198 | - cp 199 | args: 200 | - -f 201 | - /etc/kube-flannel/cni-conf.json 202 | - /etc/cni/net.d/10-flannel.conflist 203 | volumeMounts: 204 | - name: cni 205 | mountPath: /etc/cni/net.d 206 | - name: flannel-cfg 207 | mountPath: /etc/kube-flannel/ 208 | containers: 209 | - name: kube-flannel 210 | image: quay.io/coreos/flannel:v0.13.0 211 | command: 212 | - /opt/bin/flanneld 213 | args: 214 | - --ip-masq 215 | - --kube-subnet-mgr 216 | resources: 217 | requests: 218 | cpu: "100m" 219 | memory: "50Mi" 220 | limits: 221 | cpu: "100m" 222 | memory: "50Mi" 223 | securityContext: 224 | privileged: false 225 | capabilities: 226 | add: ["NET_ADMIN", "NET_RAW"] 227 | env: 228 | - name: POD_NAME 229 | valueFrom: 230 | fieldRef: 231 | fieldPath: metadata.name 232 | - name: POD_NAMESPACE 233 | valueFrom: 234 | fieldRef: 235 | fieldPath: metadata.namespace 236 | volumeMounts: 237 | - name: run 238 | mountPath: /run/flannel 239 | - name: flannel-cfg 240 | mountPath: /etc/kube-flannel/ 241 | volumes: 242 | - name: run 243 | hostPath: 244 | path: /run/flannel 245 | - name: cni 246 | hostPath: 247 | path: /etc/cni/net.d 248 | - name: flannel-cfg 249 | configMap: 250 | name: kube-flannel-cfg 251 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2020-2021 NVIDIA Corporation 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------