Puppet Class: psick::profile

Defined in:
manifests/profile.pp

Overview

This class manages /etc/profile and relevant files

Examples:

Create custom scripts under /etc/profile.d with files taken from

a local module (called profile, as in roles & profiles, ):

psick::profile::scripts_hash:
  rvm.sh:
    template: 'profile/profile/rvm.sh.erb'
  ls.sh:
    source: puppet:///modules/profile/profile/ls.sh

Export TZ variable for system optimisation

psick::profile::add_tz_optimisation: true

Parameters:

  • template (String) (defaults to: '')

    The path of the erb template (as used in template()) to use for the content of /etc/profile. If empty the file is not managed.

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

    An hash of psick::profile::script resources to create

  • add_tz_optimisation (Boolean) (defaults to: true)

    If to automatically include a script that add the TZ en variable to optimise system performance blog.packagecloud.io/eng/2017/02/21/set-environment-variable-save-thousands-of-system-calls/

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

    If to actually manage any resource in this class. If false no resource is managed. Default value is taken from main psick class.

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

    If to use the noop() function for all the resources provided by this class. If this is true the noop function is called with $noop_value argument. This overrides any other noop setting (either set on client’s puppet.conf or by noop() function in main psick class). Default from psick class.

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

    The value to pass to noop() function if noop_manage is true. It applies to all the resources (and classes) declared in this class If true: noop metaparamenter is set to true, resources are not applied If false: noop metaparameter is set to false, and any eventual noop setting is overridden: resources are always applied. Default from psick class.

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


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

class psick::profile (
  String $template             = '', # lint:ignore:params_empty_string_assignment
  Hash $options                = {},

  Hash $scripts_hash           = {},

  Boolean $add_tz_optimisation = true,

  Boolean $manage              = $psick::manage,
  Boolean $noop_manage         = $psick::noop_manage,
  Boolean $noop_value          = $psick::noop_value,
) {
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }

    if $template != '' {
      file { '/etc/profile':
        content => template($template),
      }
    }
    $scripts_hash.each | $k,$v | {
      psick::profile::script { $k:
        * => $v,
      }
    }

    file { '/etc/profile.d/tz.sh':
      ensure  => bool2ensure($add_tz_optimisation),
      content => template('psick/profile/tz.sh.erb'),
    }
  }
}