Puppet Class: virtualbox

Inherits:
virtualbox::params
Defined in:
manifests/init.pp

Summary

Installs VirtualBox.

Overview

Parameters:

  • version (String) (defaults to: '5.1')

    The major version of the package to install.

  • package_ensure (String) (defaults to: 'present')

    This gets passed to the package resource as the value of the ‘ensure’ parameter. This can be used to specify a package version.

  • manage_repo (Boolean) (defaults to: $virtualbox::params::manage_repo)

    Should this module manage the package repository? Defaults to true

  • manage_ext_repo (Boolean) (defaults to: true)

    On applicable platforms, should this module manage the external dependency repository when ‘manage_kernel` is set to true? Defaults to true

  • repo_proxy (Optional[String]) (defaults to: undef)

    proxy used by yum

  • manage_package (Boolean) (defaults to: true)

    Should this module manage the package? Defaults to true

  • manage_kernel (Boolean) (defaults to: true)

    Should this module install the VirtualBox kernel modules? Defaults to true

  • vboxdrv_dependencies (Array) (defaults to: $virtualbox::params::vboxdrv_dependencies)

    Dependencies for building the VirtualBox kernel modules. Defaults depend on the platform. See virtualbox::params.

  • package_name (String) (defaults to: $virtualbox::params::package_name)

    The name of the package to install. This must be the full packge name when not the default. When the default is in use, it gets compounded with the major.minor components of the version number. Defaults to ‘VirtualBox’ for RedHat and ‘virtualbox’ for Debian



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
# File 'manifests/init.pp', line 30

class virtualbox (
  String $version               = '5.1',
  String $package_ensure        = 'present',
  String $package_name          = $virtualbox::params::package_name,
  Boolean $manage_repo          = $virtualbox::params::manage_repo,
  Boolean $manage_ext_repo      = true,
  Boolean $manage_package       = true,
  Boolean $manage_kernel        = true,
  Array $vboxdrv_dependencies   = $virtualbox::params::vboxdrv_dependencies,
  Optional[String] $repo_proxy  = undef,
) inherits virtualbox::params {

  # this warning is never reached. If Puppet < 4 is used with tis module,
  # Puppet fail with error about data type like "Syntax error at 'String'; expected ')'"
  if versioncmp($::puppetversion, '4.0.0') == -1 {
    warning 'Support for Puppet < 3.0 is deprecated. Version 2.0 of this module will only support Puppet >= 4.0' # lint:ignore:80chars
  }

  if versioncmp($version, '5.0') == -1 {
    $vboxdrv_command = '/etc/init.d/vboxdrv'
  } else {
    $vboxdrv_command = '/usr/lib/virtualbox/vboxdrv.sh'
  }

  class { 'virtualbox::install': } -> Class['virtualbox']

  if $manage_kernel {
    Class['virtualbox::install'] -> class { 'virtualbox::kernel': }

    if $::osfamily == 'RedHat' {
      if $manage_ext_repo {
        include epel
        Class['epel'] -> Class['virtualbox::kernel']
      }
    }
  }

}