nvdarepo
Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
- Puppet >= 6.21.0 < 8.0.0
- , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'visus-nvdarepo', '0.1.8'
Learn more about managing modules with a PuppetfileDocumentation
nvdarepo
The nvdarepo module installs NVIDIA repository sources that in turn enable the installation of CUDA tools and drivers via the package manager.
Table of Contents
- Description
- Setup – The basics of getting started with nvdarepo
- Usage – Configuration options and additional functionality
- Limitations – OS compatibility, etc.
- Development – Guide for contributing to the module
Description
This module installs the NVIDIA CUDA repository to RedHad-based systems, which provides packages for CUDA tooling, CUDA libraries and NVIDIA's proprietary drivers.
Setup
Setup Requirements
This module requires puppet-yum
being installed.
Beginning with nvdarepo
Just add include ndvarepo
to add all configured repositories at their default location.
Usage
Using include nvdarepo
should be sufficient to achive everything this module supports. Currently, only the CUDA repository is installed, which can be installed separately via include nvdarepo::cuda
to make sure that no other repositories get installed if additional ones are added in future version.
If the automatic computation of the repository properties does not work, it is best customising the behaviour of the module via Hiera. Most notably, the automatically computed repository URLs of the CUDA repository depend on the following parameters:
Name | Description | Default |
---|---|---|
nvdarepo::cuda::base_url |
The base URL where all OS-dependent subdirectories are located. | https://developer.download.nvidia.com/compute/cuda/repos |
nvdarepo::cuda::key_file_name |
The name of the GPG key file. This file will be searched in the individual repository directory. | 7fa2af80.pub |
nvdarepo::cuda::key_id |
The ID of NVIDIA's GPG key. | 0xF60F4B3D7FA2AF80 |
nvdarepo::cuda::version_field |
The OS version fact used to compose the repository URL. | major |
nvdarepo::cuda::distro_override |
Forces the specified distribution name instead of the OS name fact to be used in the repository URL. | rhel or fedora, respectively |
nvdarepo::cuda::repo_src_override |
Overrides the whole repository URL. Nothing will be computed automatically. | false |
nvdarepo::cuda::key_src_override |
Overrides the whole URL of the GPG key. Nothing will be computed automatically. | false |
Furthermore, the following parameters can be used to configure the local behaviour of the module, i.e. where the repository file is stored:
Name | Description | Default |
---|---|---|
nvdarepo::cuda::repo_dir |
The directory where the repository files are stored. | /etc/yum.repos.d |
nvdarepo::cuda::repo_ext |
The file name extension of the repostiry files. | .repo |
nvdarepo::cuda::repo_owner |
User name or ID of the owner of the repository file. | root |
nvdarepo::cuda::repo_group |
Group name or ID of the owning group of the repository file. | root |
nvdarepo::cuda::key_dir |
The directory where the GPG keys are stored. | /etc/pki/rpm-gpg |
nvdarepo::cuda::key_prefix |
A prefix that is prepended to the GPG key file. | RPM-GPG-KEY- |
Installing CUDA
NVIDIA's instructions for installing CUDA suggest a specific order in which packages are to be installed. As of now, if this order is not followed, the DKMS driver packages cannot be installed, because the CUDA package installed different ones. This module provides the defined resource type nvdarepo::ordered_install
to help with this problem. nvdarepo::ordered_install
allows you to specify a specific order of packages by means of lexical order, which will be translated into Puppet dependencies by the defined resource type. It is a reasonable approach to use numbers to establish this lexical order. For instance, you could do something like this
class profile::cuda(Hash $packages) {
# Ensure that NVIDIA repositories are present.
require nvdarepo
# Make sure that dependencies for building the kernel module are present.
ensure_packages([ 'gcc', 'epel-release', 'kernel-devel' ] )
# Install packages configured via Hiera.
nvdarepo::ordered_install { 'cuda':
packages => $packages
}
# Make sure that NVIDIA module is installed.
~> exec { '/usr/sbin/dkms autoinstall -m nvidia': }
}
and specify the packages and their order in Hiera as
profile::cuda::packages:
00-nvidia-driver-latest-dkms:
name: nvidia-driver-latest-dkms
ensure: installed
01-cuda:
name: cuda
ensure: installed
02-cuda-drivers:
name: cuda-drivers
ensure: installed
03-libcudnn8-devel:
name: libcudnn8-devel
ensure: installed
If you have environment modules installed on your machine and want to be able to switch between CUDA versions, you can use nvdarepo::cuda-module-files
to automatically create module files for all packages of format cuda[-version]
:
class profile::cuda(Hash $packages) {
# Other stuff here ...
~> nvdarepo::cuda_module_files { 'cuda-module-files':
packages => $packages
}
}
Note that nvdarepo::cuda-module-files
will automatically make sure that the environment-modules
package is installed on your system.
Limitations
Only distributions listed in metadata.json
are supported.
Development
Open a pull request on GitHub.
Reference
Table of Contents
Classes
nvdarepo
: Installs NVIDIA package repositories.nvdarepo::cuda
: (Un-) Installs the NVIDIA CUDA repository.
Defined types
nvdarepo::cuda_module_files
: (Un-) Installs a module file for making specific CUDA versions available on demand.nvdarepo::ordered_install
: (Un-) Installs packages in a specific order.nvdarepo::repo
: (Un-) Installs a repository along with its GPG key.
Classes
nvdarepo
Installs all known NVIDIA repositories, which is at the moment only the CUDA repository which provides CUDA tools and appropriate drivers. This extra class is currently only there for future extensibility.
nvdarepo::cuda
This class basically does nothing but instantiating the nvdarepo::repo utility. Its main purpose is providing a class to which configuration data can be assigned via Hiera.
Parameters
The following parameters are available in the nvdarepo::cuda
class:
base_url
version_field
repo_src_override
distro_override
repo_dir
repo_ext
repo_owner
repo_group
key_id
key_file_name
key_src_override
key_dir
key_prefix
ensure
disable_repos
base_url
Data type: String
The base URL where NVIDIA's repositories are located. If no repo_src is provided, the module will construct the URL from this base URL using the known way NVIDIA is organising their server.
version_field
Data type: String
This parameter determines which of the version facts is used to automatically construct the URL of the repository. The parameter defaults to 'major', ie the major version of the distribution is used to construct the repository source.
repo_src_override
Data type: Variant[String, Boolean]
Overrides the generated URL of the repository file with the specified value. This parameter defaults to false, which indicates that the repository URL should be computed automatically.
Default value: false
distro_override
Data type: Variant[String, Boolean]
Overrides the name in the distribution for the purpose of generating the repository URL. This value is only used when repo_src_override is not set. The parameter defaults to false, which indicates that the OS name from Puppet facts is used in lower case.
Default value: false
repo_dir
Data type: String
The directory where to install the repository file, ie "/etc/yum.repos.d" for RedHat-based systems.
repo_ext
Data type: String
The extension of the repository file, typically ".repo".
repo_owner
Data type: Variant[String, Integer]
The name or UID of the owning user of the repository file.
repo_group
Data type: Variant[String, Integer]
The name or UID of the owning group of the repository file.
key_id
Data type: String
The ID of the GPG key used by the repository.
key_file_name
Data type: String
The name of the GPG key file to be installed.
key_src_override
Data type: Variant[String, Boolean]
Override the full URL of from which the GPG key is retrieved. Otherwise, the key is searched in the repository directory.
Default value: false
key_dir
Data type: String
The directory where the key should be installed. This is only used on RedHat-based systems.
key_prefix
Data type: String
An additional prefix string that is added before the name of the key file. This is only used on RedHat-based systems.
ensure
Data type: String
Determines whether the repository should be present or absent. This defaults to "present".
Default value: present
disable_repos
Data type: Array[String]
Allows for specifying yum repositories to be disabled. This is required to handle a conflict with rpmfusion-nonfree on Fedora.
Default value: []
Defined types
nvdarepo::cuda_module_files
This is a utility type that can be used by administrators to create module files for installed CUDA versions. This allows end users to use the module enviroment to switch between different versions of CUDA as necessary.
Parameters
The following parameters are available in the nvdarepo::cuda_module_files
defined type:
packages
Data type: Hash
The hash from the ordered_install, which is used to filter CUDA packages and create the module files for them.
ensure
Data type: String
Indicates whether the module file should be written or removed. This defaults to 'present'.
Default value: present
module_dir
Data type: String
The directory receiving the module file. This parameter defaults to '/etc/modulefiles'.
Default value: '/etc/modulefiles'
install_dir
Data type: String
The directory where CUDA is assumed to be installed. If a specific version is selected, this version is suffixed to this path, wherefore it should not be terminated with a directory separator. This parameter defaults to '/usr/local/cuda'.
Default value: '/usr/local/cuda'
system_version
Data type: String
The version string used for the default current version of CUDA. This parameter defaults to 'system'.
Default value: 'system'
module_packages
Data type: Array[String]
Default value: [ 'environment-modules' ]
nvdarepo::ordered_install
Installing CUDA on RHEL systems requires packages being installed in a specific order to use the DKMS driver module. This utility class enables you to do that by specifying aliases for the packages that define the order by means of their lexical order. The keys in the $packages hash given to the module determines this order. A dependency relationship between these keys will be established by this module. In order to specify this order in Hiera, it is best using keys starting with numbers like it is common in conf.d directories.
Parameters
The following parameters are available in the nvdarepo::ordered_install
defined type:
packages
Data type: Hash
The $packages parameter is a hash specifying the packages to be installed. The keys of that hash determine the order in which the installation happens. The hash should at least hold the attributes "name" with the actual name of the package and "ensure" with the installation instruction. All of the per-package attributes are passed on to the installation, i.e. you can use every parameter that is acceptable for the Package resource.
nvdarepo::repo
This is a utility type that is used by the nvdarepo class. It is not intended for direct use by end users. One main feature of the type is that it can compute the repository location based on the current layou of NVIDIA's server from the OS information provided by Puppet.
Parameters
The following parameters are available in the nvdarepo::repo
defined type:
base_url
version_field
repo_src_override
distro_override
repo_dir
repo_ext
repo_owner
repo_group
key_id
key_file_name
key_src_override
key_dir
key_prefix
ensure
disable_repos
base_url
Data type: String
The base URL where NVIDIA's repositories are located. If no repo_src is provided, the module will construct the URL from this base URL using the known way NVIDIA is organising their server.
version_field
Data type: String
This parameter determines which of the version facts is used to automatically construct the URL of the repository. The parameter defaults to 'major', ie the major version of the distribution is used to construct the repository source.
repo_src_override
Data type: Variant[String, Boolean]
Overrides the generated URL of the repository file with the specified value.
Default value: false
distro_override
Data type: Variant[String, Boolean]
Overrides the name in the distribution for the purpose of generating the repository URL. This value is only used when repo_src_override is not set.
Default value: false
repo_dir
Data type: String
The directory where to install the repository file, ie "/etc/yum.repos.d" for RedHat-based systems.
repo_ext
Data type: String
The extension of the repository file, typically ".repo".
repo_owner
Data type: Variant[String, Integer]
The name or UID of the owning user of the repository file.
repo_group
Data type: Variant[String, Integer]
The name or UID of the owning group of the repository file.
key_id
Data type: String
The ID of the GPG key used by the repository.
key_file_name
Data type: String
The name of the GPG key file to be installed.
key_src_override
Data type: Variant[String, Boolean]
Override the full URL of from which the GPG key is retrieved. Otherwise, the key is searched in the repository directory.
Default value: false
key_dir
Data type: String
The directory where the key should be installed. This is only used on RedHat-based systems.
key_prefix
Data type: String
An additional prefix string that is added before the name of the key file. This is only used on RedHat-based systems and should be something like "RPM-GPG-KEY-".
ensure
Data type: String
Determines whether the repository should be present or absent. This defaults to "present".
Default value: present
disable_repos
Data type: Array[String]
Allows for specifying yum repositories to be disabled. This is required to handle a conflict with rpmfusion-nonfree on Fedora.
Default value: []
Changelog
All notable changes to this project will be documented in this file.
Release 0.1.0
- Initial release of the module.
Release 0.1.1
- Updated documentation.
Release 0.1.2
- Adapted location from where GPG keys are downloaded.
- Source of GPG key can now be fully overriden via key_src_override.
Release 0.1.3
- Installation of GPG key is now mandatory.
- Added ordered_install feature to allow for automating the installation of CUDA along with the DKMS-variant of the driver as described on NVIDIA's website.
- Updated documentation.
Release 0.1.4
- Updated documentation.
Release 0.1.5
- Added the option to disable conflicting repositories, notably rpmfusion-nonfree on Fedora.
- Updated NVIDIA's repository keys to be installed.
Release 0.1.6
- Added the option to write environment modules for CUDA versions being installed.
Release 0.1.7
- Fix generation of module files.
Release 0.1.8
- Added the ability to have ordered_install remove conflicting packages from other sources.
Dependencies
- puppetlabs-stdlib (>=5.0.0)