Puppet Class: virtualbox

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

Overview

Class: virtualbox

This is a public class. This class installs VirtualBox.

Parameters

version

The major version of the package to install. Defaults to 5.0

package_ensure

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

manage_repo

Should this module manage the package repository? Defaults to true

manage_ext_repo

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

repo_proxy

Defaults to undef

manage_package

Should this module manage the package? Defaults to true

manage_kernel

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

vboxdrv_dependencies

Dependencies for building the VirtualBox kernel modules. Defaults depend on the platform. See 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

Parameters:

  • version (String) (defaults to: $virtualbox::params::version)
  • package_ensure (String) (defaults to: $virtualbox::params::package_ensure)
  • package_name (String) (defaults to: $virtualbox::params::package_name)
  • manage_repo (Boolean) (defaults to: $virtualbox::params::manage_repo)
  • manage_ext_repo (Boolean) (defaults to: $virtualbox::params::manage_ext_repo)
  • manage_package (Boolean) (defaults to: $virtualbox::params::manage_package)
  • manage_kernel (Boolean) (defaults to: $virtualbox::params::manage_kernel)
  • vboxdrv_dependencies (Array) (defaults to: $virtualbox::params::vboxdrv_dependencies)
  • repo_proxy (Optional[String]) (defaults to: $virtualbox::params::repo_proxy)


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

class virtualbox (
  String $version               = $virtualbox::params::version,
  String $package_ensure        = $virtualbox::params::package_ensure,
  String $package_name          = $virtualbox::params::package_name,
  Boolean $manage_repo          = $virtualbox::params::manage_repo,
  Boolean $manage_ext_repo      = $virtualbox::params::manage_ext_repo,
  Boolean $manage_package       = $virtualbox::params::manage_package,
  Boolean $manage_kernel        = $virtualbox::params::manage_kernel,
  Array $vboxdrv_dependencies   = $virtualbox::params::vboxdrv_dependencies,
  Optional[String] $repo_proxy  = $virtualbox::params::repo_proxy,
) 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']
      }
    }
  }

}