Puppet Class: psick::base

Defined in:
manifests/base.pp

Overview

This class includes base classes that manage the common baseline resources generally applied to any node. Is exposes parameters that allow to define any class (from Psick, public modules or local profiles) to include after the prerequisites classes declared in the osich::pre class. For each different $facts value a differet entrypoint is exposed.

For each of these $facts_classes parameters, it’s expected an Hash of key-values: Keys can have any name, and are used as markers to allow overrides, exceptions management and customisations across Hiera’s hierarchies. Values are actual class names to include in the node’s catalog. They can be classes from psick module or any other module, both public ones (the typical component modules from the Forge) and private site profiles and modules.

Examples:

Manage common baseline classes for Linux and Windows:

psick::base::linux_classes:
  users: '::psick::users'
  sudo: '::psick::sudo'
  logs: '::psick::logs::rsyslog'
  time: '::psick::time'
psick::base::windows_classes:
  time: '::psick::time'
  hostname: '::psick::hostname'

Disable inclusion of a class of the given marker. Here the

class marked as 'users' is set to an empty value and hence is
not included. Use this to manage exceptions and variations
overriding defaults set at more common Hiera layers.
  psick::base::linux_classes:
    'users': ''

Disable the whole class (no resource from this class is declared)

psick::base::manage: false

Parameters:

  • linux_classes (Psick::Class) (defaults to: {})

    Hash with the list of classes to include in the common baseline when $facts is Linux. Of each key-value of the hash, the key is used as marker to eventually override across Hiera hierarchies and the value is the name of the class to actually include. Any key name can be used, but the value must be a valid class existing the the $modulepath. If the value is set to empty string (”) then the class of the relevant marker is not included.

  • windows_classes (Psick::Class) (defaults to: {})

    Hash with the list of classes to include in the common baseline when $facts is windows.

  • solaris_classes (Psick::Class) (defaults to: {})

    Hash with the list of classes to include in the common baseline when $facts is Solaris.

  • darwin_classes (Psick::Class) (defaults to: {})

    Hash with the list of classes to include in the common baseline when $facts is Darwin.

  • 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.



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

class psick::base (

  Psick::Class $linux_classes   = {},
  Psick::Class $windows_classes = {},
  Psick::Class $darwin_classes  = {},
  Psick::Class $solaris_classes = {},

  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 !empty($linux_classes) and $facts['kernel'] == 'Linux' {
      $linux_classes.each |$n,$c| {
        if $c != '' {
          contain $c
        }
      }
    }
    if !empty($windows_classes) and $facts['kernel'] == 'windows' {
      $windows_classes.each |$n,$c| {
        if $c != '' {
          contain $c
        }
      }
    }
    if !empty($darwin_classes) and $facts['kernel'] == 'Darwin' {
      $darwin_classes.each |$n,$c| {
        if $c != '' {
          contain $c
        }
      }
    }
    if !empty($solaris_classes) and $facts['kernel'] == 'Solaris' {
      $solaris_classes.each |$n,$c| {
        if $c != '' {
          contain $c
        }
      }
    }
  }
}