Puppet Class: collectd::plugin::cuda

Defined in:
manifests/plugin/cuda.pp

Overview

Class: collectd::plugin::cuda

Parameters:

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    Optional Passed to package and collectd::plugin resources (both). Default: present

  • manage_package (Optional[Boolean]) (defaults to: undef)

    Optional Toggles installation of plugin. Default: undef

  • package_name (String[1]) (defaults to: 'collectd-cuda')

    Optional Name of plugin package to install. Default: collectd-cuda

  • package_provider (Optional[String[1]]) (defaults to: undef)

    Optional Passed to package resource. Default: pip

  • provider_proxy (Optional[String[1]]) (defaults to: undef)

    Optional Proxy for provider. Default: undef

See Also:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'manifests/plugin/cuda.pp', line 13

class collectd::plugin::cuda (
  Enum['present', 'absent'] $ensure     = 'present',
  Optional[Boolean] $manage_package     = undef,
  String[1] $package_name               = 'collectd-cuda',
  Optional[String[1]] $package_provider = undef,
  Optional[String[1]] $provider_proxy   = undef,
) {
  include collectd

  $_manage_package = pick($manage_package, $collectd::manage_package)
  if ($facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8') or ($facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '20.04') {
    $_python_pip_package = 'python3-pip'
    if $package_provider =~ Undef {
      $_package_provider = 'pip3'
    }
    else {
      $_package_provider = $package_provider
    }
  } else {
    $_python_pip_package = 'python-pip'
    if $package_provider =~ Undef {
      $_package_provider = 'pip'
    }
    else {
      $_package_provider = $package_provider
    }
  }

  if ($_manage_package) {
    if (!defined(Package[$_python_pip_package])) {
      package { $_python_pip_package: ensure => 'present', }

      Package[$package_name] {
        require => Package[$_python_pip_package],
      }

      if $facts['os']['family'] == 'RedHat' {
        # Epel is installed in install.pp if manage_repo is true
        # python-pip doesn't exist in base for RedHat. Need epel installed first
        if (defined(Class['epel'])) {
          Package[$_python_pip_package] {
            require => Class['epel'],
          }
        }
      }
    }
  }

  if ($_manage_package) and ($provider_proxy) {
    $install_options = [{ '--proxy' => $provider_proxy }]
  } else {
    $install_options = undef
  }

  package { $package_name:
    ensure          => $ensure,
    provider        => $_package_provider,
    install_options => $install_options,
  }

  collectd::plugin::python::module { 'collectd_cuda.collectd_plugin':
    ensure => $ensure,
  }
}