Puppet Class: collectd::plugin::iscdhcp

Defined in:
manifests/plugin/iscdhcp.pp

Overview

Class: collectd::plugin::iscdhcp

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-iscdhcp')

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

  • 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:



12
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/iscdhcp.pp', line 12

class collectd::plugin::iscdhcp (
  Enum['present', 'absent'] $ensure     = 'present',
  Optional[Boolean] $manage_package     = undef,
  String[1] $package_name               = 'collectd-iscdhcp',
  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_iscdhcp.collectd_plugin':
    ensure => $ensure,
  }
}