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/

  • no_noop (Boolean) (defaults to: false)

    Set noop metaparameter to false to all the resources of this class. This overrides any noop setting which might be in place.

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

    If to actually manage any resource in this profile or not

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


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

class psick::profile (
  String $template   = '',
  Hash $options      = {},

  Hash $scripts_hash = {},

  Boolean $add_tz_optimisation = true,

  Boolean $manage = $::psick::manage,
  Boolean $no_noop = false,
) {

  if $manage {
    # If no_noop is set it's enforced, unless psick::noop_mode is
    if ! $::psick::noop_mode and $no_noop {
      info('Forced no-noop mode in psick::profile')
      noop(false)
    }

    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'),
    }
  }
}