Skip to content

Commit

Permalink
Update Enroot to install optional dependencies (#224)
Browse files Browse the repository at this point in the history
* Initial commit for adding enroot optional packages

* Adding nvidia-container role for repository

Removing tty from gpg dearmor to prevent error in ansible build

* Fixes for RHEL based distros

* Update to address PR review
  • Loading branch information
cdunbar13 authored Oct 17, 2024
1 parent 193b64c commit b3a4339
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 0 deletions.
1 change: 1 addition & 0 deletions ansible/roles/enroot/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
enroot_version: 09ae4b2c18a18ed5ab34b7697006aa18697c4cec
enroot_url: https://github.com/NVIDIA/enroot/
enroot_installation_path: "{{ paths.install }}"
enroot_install_optional_deps: true
18 changes: 18 additions & 0 deletions ansible/roles/enroot/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

dependencies:
- role: nvidia_container_toolkit_repo
when: enroot_install_optional_deps
6 changes: 6 additions & 0 deletions ansible/roles/enroot/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
name: '{{ enroot_runtime_dependencies }}'
state: present

- name: Install enroot optional runtime dependencies
ansible.builtin.package:
name: '{{ enroot_optional_runtime_dependencies }}'
state: present
when: enroot_install_optional_deps

- name: Download enroot
ansible.builtin.git:
repo: '{{ enroot_url }}'
Expand Down
6 changes: 6 additions & 0 deletions ansible/roles/enroot/vars/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ enroot_runtime_dependencies:
- squashfs-tools
- parallel
- zstd

enroot_optional_runtime_dependencies:
- fuse-overlayfs
- libnvidia-container-tools
- pigz
- squashfuse
6 changes: 6 additions & 0 deletions ansible/roles/enroot/vars/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ enroot_runtime_dependencies:
- squashfs-tools
- parallel
- zstd

enroot_optional_runtime_dependencies:
- fuse-overlayfs
- libnvidia-container-tools
- pigz
- squashfuse
19 changes: 19 additions & 0 deletions ansible/roles/nvidia_container_toolkit_repo/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

nvidia_gpg_key_url: https://nvidia.github.io/libnvidia-container/gpgkey
nvidia_repo_url_deb: https://nvidia.github.io/libnvidia-container/stable/deb
nvidia_gpg_key_deb: /etc/apt/keyrings/nvidia-container-toolkit-keyring.asc
nvidia_repo_file_rpm: https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo
24 changes: 24 additions & 0 deletions ansible/roles/nvidia_container_toolkit_repo/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Include OS Family Dependent Tasks
include_tasks: '{{ item }}'
with_first_found:
- os/{{ ansible_distribution|lower }}-{{ ansible_distribution_version }}.yml
- os/{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version }}.yml
- os/{{ ansible_distribution|lower }}.yml
- os/{{ ansible_os_family|lower }}-{{ ansible_distribution_version }}.yml
- os/{{ ansible_os_family|lower }}-{{ ansible_distribution_major_version }}.yml
- os/{{ ansible_os_family|lower }}.yml
26 changes: 26 additions & 0 deletions ansible/roles/nvidia_container_toolkit_repo/tasks/os/debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Collect Nvidia Container Repo GPG Key
ansible.builtin.get_url:
url: "{{ nvidia_gpg_key_url }}"
dest: "{{ nvidia_gpg_key_deb }}"
mode: '0644'
force: true

- name: Add Nvidia Container Repo
ansible.builtin.apt_repository:
repo: "deb [arch=amd64 signed-by={{ nvidia_gpg_key_deb }}] {{ nvidia_repo_url_deb }}/$(ARCH) /"
filename: nvidia-container-toolkit
19 changes: 19 additions & 0 deletions ansible/roles/nvidia_container_toolkit_repo/tasks/os/redhat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Add Nvidia Container Repo
ansible.builtin.get_url:
url: '{{ nvidia_repo_file_rpm }}'
dest: /etc/yum.repos.d/nvidia-container-toolkit.repo

0 comments on commit b3a4339

Please sign in to comment.