Puppet Class: psick::virtualbox::tp

Defined in:
manifests/virtualbox/tp.pp

Summary

This psick profile manages virtualbox with Tiny Puppet (tp)

Overview

psick::virtualbox::tp

Examples:

Include it to install virtualbox

include psick::virtualbox::tp

Include in PSICK via hiera (yaml)

psick::profiles::linux_classes:
  virtualbox: psick::virtualbox::tp

Manage extra configs via hiera (yaml) with templates based on custom options

psick::virtualbox::tp::ensure: present
psick::virtualbox::tp::resources_hash:
  tp::conf:
    virtualbox:
      epp: profile/virtualbox/virtualbox.conf.epp
    virtualbox::dot.conf:
      epp: profile/virtualbox/dot.conf.epp
      base_dir: conf
psick::virtualbox::tp::options_hash:
  key: value

Enable default auto configuration, if configurations are available

for the underlying system and the given auto_conf value, they are
automatically added (Default value is inherited from global $::psick::auto_conf
psick::virtualbox::tp::auto_conf: 'default'

Parameters:

  • manage (Boolean) (defaults to: $::psick::manage)

    If to actually manage any resource in this profile or not

  • ensure (Psick::Ensure) (defaults to: 'present')

    If to install or remove virtualbox. Valid values are present, absent, latest or any version string, matching the expected virtualbox package version.

  • resources_hash (Hash) (defaults to: {})

    An hash of tp::conf and tp::dir resources for virtualbox. tp::conf params: github.com/example42/puppet-tp/blob/master/manifests/conf.pp tp::dir params: github.com/example42/puppet-tp/blob/master/manifests/dir.pp

  • resources_auto_conf_hash (Hash) (defaults to: {})

    The default resources hash if auto_conf is set. Default value is based on $::psick::auto_conf. Can be overridden or set to an empty hash. The final resources manages are the ones specified here and in $resources_hash. Check psick::virtualbox::tp:resources_auto_conf_hash in data/$auto_conf/*.yaml for the auto_conf defaults.

  • install_hash (Hash) (defaults to: {})

    An hash of valid params to pass to tp::install defines. Useful to manage specific params that are not automatically defined.

  • options_hash (Hash) (defaults to: {})

    An open hash of options to use in the templates referenced in the tp::conf entries of the $resources_hash.

  • options_auto_conf_hash (Hash) (defaults to: {})

    The default options hash if auto_conf is set. Check psick::virtualbox::tp:options_auto_conf_hash in data/$auto_conf/*.yaml for the auto_conf defaults.

  • settings_hash (Hash) (defaults to: {})

    An hash of tp settings to override default virtualbox file paths, package names, repo info and whatever can match Tp::Settings data type: github.com/example42/puppet-tp/blob/master/types/settings.pp

  • auto_prereq (Boolean) (defaults to: $::psick::auto_prereq)

    If to automatically install eventual dependencies for virtualbox. Set to false if you have problems with duplicated resources, being sure that you manage the prerequistes to install virtualbox (other packages, repos or tp installs).

  • no_noop (Boolean) (defaults to: false)

    Set noop metaparameter to false to all the resources of this class. This overrides client site noop setting but not $psick::noop_mode.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'manifests/virtualbox/tp.pp', line 55

class psick::virtualbox::tp (
  Psick::Ensure   $ensure                   = 'present',
  Boolean         $manage                   = $::psick::manage,
  Hash            $resources_hash           = {},
  Hash            $resources_auto_conf_hash = {},
  Hash            $install_hash             = {},
  Hash            $options_hash             = {},
  Hash            $options_auto_conf_hash   = {},
  Hash            $settings_hash            = {},
  Boolean         $auto_prereq              = $::psick::auto_prereq,
  Boolean         $no_noop                  = false,
) {

  if $manage {
    if !$::psick::noop_mode and $no_noop {
      info('Forced no-noop mode in psick::virtualbox::tp')
      noop(false)
    }
    $options_all = $options_auto_conf_hash + $options_hash
    $install_defaults = {
      ensure        => $ensure,
      options_hash  => $options_all,
      settings_hash => $settings_hash,
      auto_repo     => $auto_prereq,
      auto_prereq   => $auto_prereq,
    }
    tp::install { 'virtualbox':
      * => $install_defaults + $install_hash,
    }

    # tp::conf iteration based on $resources_hash['tp::conf']
    $file_ensure = $ensure ? {
      'absent' => 'absent',
      default  => 'present',
    }
    $conf_defaults = {
      ensure        => $file_ensure,
      options_hash  => $options_all,
      settings_hash => $settings_hash,
    }
    $tp_confs = pick($resources_auto_conf_hash['tp::conf'], {}) + pick($resources_hash['tp::conf'], {})
    # All the tp::conf defines declared here
    $tp_confs.each | $k,$v | {
      tp::conf { $k:
        * => $conf_defaults + $v,
      }
    }

    # tp::dir iteration on $resources_hash['tp::dir']
    $dir_defaults = {
      ensure             => $file_ensure,
      settings_hash      => $settings_hash,
    }
    # All the tp::dir defines declared here
    $tp_dirs = pick($resources_auto_conf_hash['tp::dir'], {}) + pick($resources_hash['tp::dir'], {})
    $tp_dirs.each | $k,$v | {
      tp::dir { $k:
        * => $dir_defaults + $v,
      }
    }
  }
}